• Post Reply Bookmark Topic Watch Topic
  • New Topic

Fileuploading via org.apache.commons.fileupload

 
Daslan Govender
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


I am using the above API to perform file uploading. The problem that I am having is that when I upload to a machine other than where the application is running (i.e: DMZ). I get an access denied error. How do I provide credentails so that I can upload to the remote box?


Tks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm unclear on what you're trying to do. How do you propose to upload a file to a server where the upload application is not running? FileUpload implements the *server* side of the upload, i.e. where the file will end up, not where it originates.
Access Denied most likely means that HTTP authentication is required, which most HTTP client libraries can handle. What do you use for the *client* side?
 
Daslan Govender
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


Apologies for the confusion. This is what is happening. On the client side, the user selects the file to upload and clicks the submit button of the html form. The server then validates and processes the request.

One of the request attibutyes is a file. The server extracts the file and need to copy this to the DMZ box. What I meant, is that the DMZ does not process the request, it merely stores the file.

The problem is how do I access the dmz OR rather how do I specify the username and password that the dmz requires. What libs are you referring to? Please give some egs?


Tks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I see. You have uploaded the file to the server, and now the server needs to transfer it to another server. The options depend on how the DMZ server is accessible: FTP, SMB, HTTP, ... ?
Check the Applets FAQ, which is linked in my signature, for some (non-applet-specific) libraries you can use in each of these cases.
 
Daslan Govender
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tks. I decided to use ftp. However I am getting a problem. The pdf that is now stroed on the ftp server is damaged.


What trsnfer mode should I use?


The file is stored temp on the machine as java.io.File. I convert this file to a FileInputStream object. I then use the overloaded FTPClient.storeFile() to store the file. Could t his be the problem?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you use binary transfer. Is the file length the same on the server as it is on the client?
 
Daslan Govender
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tks. It is working now. The file sizes are now the same.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!