I am writing a FTP interface in PHP. When I upload files with it using enctype="multipart/form-data" the file name I am getting back is encrypted and unreadable. I want to know if there is a way to upload using enctype="multipart/form-data" so that the file name variable is the same as the filename that was posted. Is there a header or something I am missing?
enctype="multipart/form-data"
Im trying to build a ftp 'portal', too. It
s nearly finshed, I`m only searching for way to set up a upload status window.
About your problem:
You have to use the enctype="multipart/form-data" in the form-tag.
For the 'action' - php script you now have the variables:
$userfile = path and name of the file in your temporary folder(that the 'encrypted')
$userfile_name = THE ORIGINAL FILENAME !
$userfile_size = the original filesize
$userfile_type = the mime format
userfile ist the name whitch is used in the input-tag:
<input type='file' name='userfile'....
With these variables you can easily copy the file:
copy ($userfile", "..test/$userfile_name");
or use an ftp-server:
$upload = ftp_put($server, "../test/$userfile_name", $userfile, FTP_BINARY);
(excuse my bad english
I hope I am right on track here...
You are telling me that is if the field name is userfile, then all of the other variables that you mentioned (like userfile_name) are automatically set by php.?
Man, if I wish I would have realized that is what the documentation on file.uploads was trying to say. I suppose I was haveing a little brain spasm!
Tell me more about what you are trying to do with the status window. Right now (with the encrypted name problem solved) my upload works so fast I wouldn't have a chance to display any sort of status window, unless you just want something that says "your upload is complete". My download is the same way, fast.
Maybe I can help you out a little (like you did me) if I better understand your delima.
Dan
Yes, thats all. You
ll get the variables automatically. You don`t have to name your input field "userfile". You can choose any name.
F.e.:
<input type='field' name='helloworld'...
Then the variables are:
$helloworld
$helloworld_name
$helloworld_size
I dont want a page, that says 'your upload is finished'... that would be very easy.
m searching for a dynamic status window that shows you somthing like this:
No, I
3,6Mb of 10 Mb done
and that all the time while the upload is running. Perhaps a graphical statusbar would be nice too.
To make it, I need the original filesize (before the upload starts!!!) and the recepted filesize, so that I could compare them.
I searched a long time for a way to get the needed data, but for now I thing, its impossible with a simple php and/or JavaScript.
t explain it better in english, for an example have a look at www.freedrive.com
I can
If you have an account with them, you should try to upload a file. Then youll get a new window with a statusbar. That
s what I want to have. Couse, while you upload a file normaly, the page is frozen till the whole file is up. So you dont know if it
s working at all.