Link to home
Start Free TrialLog in
Avatar of nlpalmquist
nlpalmquistFlag for United States of America

asked on

HTTPS POST with a file Upload

I need dynamic web page that will upload a file to a web service.  I would very much like the web page to be able to know the file name automatically and execute submit. Without the file upload, I can make a page submit automatic but I can not seem to get the page to handle the file upload <INPUT type="file"> without stopping to browse for the filename.

The exact file to be uploaded could easily be built into the HTML but I can not seem to find a way to make that happen.  I generated a unique HTML page to include all the other form data necessary on the form but I can not seem to make the file upload automatic.

If that does not have a solution, I would like to at least have the browse open in a default folder to make it easy for the user to select the file.  That seems to be difficult also.  It keeps dropping back to Documents.  

General Environment will be out of my control except to say that the local computers will be running Windows XP or Windows 7 machines so I need to program to a model that will not be an issue in various browsers and versions of browsers.

<FORM NAME="form1" ACTION="service information" METHOD="POST" ENCTYPE="multipart/form-data">
Select File to Upload:
<INPUT TYPE="file" NAME="uploadedfile">
</FORM>

Stripped out everything but the bits that affect the upload

I have no idea if this can be accomplished with some javascript or php or if there is some additional HTML that I am missing.  Any help would be appreciated.
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dave Baldwin
Ray is right, you can not do what you are asking.  Think about it.  How would you feel if you went to a web site and it automatically started uploading files from your computer?  There is no way to make an exception to this in a web browser.
If you can get the client to install an application, you might be able to make this happen.  The app could be triggered to start an upload.  I do not know how to do this, but I expect it is feasible.  Of course your clients would have to trust and deploy the app, knowing that it could access any file on the computer.  Personally, I would not deploy the app.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nlpalmquist

ASKER

I appreciate the input.  I figured as much, that I would need additional software or something to handle such an issue.  It would be nice if I could at least get them in the right folder to select the appropriate file, but I have added instructions on the web page to make that easier for them.  I was just hoping that I could make it as simple as possible, but security is also important.

Thanks for the prompt answers.
DropBox might be a really good answer to the issue.

Thanks for the points and thanks for using EE, ~Ray