Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<input name="userfile" size=50 type="file">

Status
Not open for further replies.

Ztruker

Technical User
Nov 26, 2010
13
US
Upgrading from very old Apache 1.3.27 to 2.2.21. Also upgrading to latest PHP 5.3.3 and MySQL 5.5.

I have an input filed: <input name="userfile" size=50 type="file"> that I use to select a file from my hard drive to upload to my web server. The problem I'm having is the field is read only. I can't type into it or make any changes to the path and file I selected.

This is not the case with my older setup so something has changed in Apache. How do I correct this? I could find nothing in httpd.conf that seemed to apply.

Thank you for any help you can provide.

Rich K.
 
The reason I need to do this is so I can upload multiple files via PHP to my server by changing the selected file from:

D:\Canon\Pictures\2011_10_14\IMG_0001.jpg

to

D:\Canon\Pictures\2011_10_14\IMG_*.jpg

That tells my PHP code to upload any files that match the specified input name.

Hope that makes sense.

Rich K.
 
Hi

Rich said:
The problem I'm having is the field is read only. I can't type into it or make any changes to the path and file I selected.
This has absolutely nothing to do with the web server or the server-side script which will process the form after submit.

This is an irritating practice, as far as I know, introduced by Safari, where the [tt]input type="file"[/tt] was a browse button and the file's name was displayed beside as plain text. Newer versions of FireFox and Opera is imitating that by not allowing to edit the file name. Again, there is nothing the web server or a server-side script could influence.
Rich said:
The reason I need to do this is so I can upload multiple files via PHP to my server by changing the selected file from:

D:\Canon\Pictures\2011_10_14\IMG_0001.jpg

to

D:\Canon\Pictures\2011_10_14\IMG_*.jpg
Such wildcard may or may not work, depending on the browser. But personally I know no browser that would accept it.
Rich said:
That tells my PHP code to upload any files that match the specified input name.
But would certainly not work that way. PHP fortunately can not access the remote machine's devices, so can not find out what file names are matching the wildcard. PHP can only process what the browser sends.

The [tt]multiple[/tt] attribute of the [tt]input[/tt] tags introduced in HTML5 solves this. Browsers that supports it will allow you to select multiple files in the browse window, will enumerate all their names in the [tt]input[/tt] tag and will upload them all to the server. Gecko, Presto and WebKit browsers are supporting it for a while, but Trident not yet.

Alternatively you could think to one of the available dedicated solutions, like Uploadify. Those mostly use Flash.

As I have a feeling that you want this only for yourself to upload to your own website, I suggest to think about using a command line solution. [tt]lwp-request[/tt] ( from the libwww-perl package ), cURL and GNU Wget can upload a file from the command line, or you can even script it with GNU Netcat. Of course, forget this paragraph if I misunderstood your intention.


Feherke.
 
I use this method locally on the web server itself for uploading multiple pictures at one time from the specified directory. The PHP code is written to handle it.

I'll have to find some other way to do this then.

Thanks you for the explanation. I use SeaMonkey which is the Mozilla follow-on and shares much of it's code base with FireFox so gets stuck with all the changes that are put into FireFox.

It's the same with IE. I have not tried it with Chrome yet. I'll give that a try next. I wonder if Safari allows it?

Rich K.
 
Just re-read your response and noticed the multiple tag. That will do it for me.

Many thanks again.

Rich K.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top