Forums
This topic is locked
php file upload - how to pass the file name?
Posted 02 Apr 2003 04:20:59
1
has voted
02 Apr 2003 04:20:59 Natalia Usselman posted:
I have done this before and am puzzled, as I can't figure out what's happening now. ( I am using PHP upload DMX extension)I have a form with file upload created with php behaviour. I need to pass the file name (just the file name) to the next page.
I used to be able to do this:
file field name is "location". I pass a variable $location in URl as Post and get a full path - D:\\!The Gold Room\\source\\small\\necklace11.jpg as a value of a variable $location on the next page. Then I extract the file name from there.
Now on the next page I am getting some gibberish $location=/tmp/phpQ35dgc
Huh? What happened?
Replies
Replied 02 Apr 2003 08:51:26
02 Apr 2003 08:51:26 Julio Taylor replied:
unata,
on the 2nd page you can call the variable of the form element (file field) using $_GET or $_POST depending on your form METHOD. however i think depending on your form TYPE <i>(application/x-www-form-urlencoded / multipart/form-data)</i> you may get different results on this. i know that one of the types will send accross the entire path, it's done it form me before- the only problem was that it sent the data with added slashes (e.g. C:\\my documents\\files\\file.png).
what type have you used so far? try playing with the other one. i wonder if the version of PHP used has an effect in this?
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
on the 2nd page you can call the variable of the form element (file field) using $_GET or $_POST depending on your form METHOD. however i think depending on your form TYPE <i>(application/x-www-form-urlencoded / multipart/form-data)</i> you may get different results on this. i know that one of the types will send accross the entire path, it's done it form me before- the only problem was that it sent the data with added slashes (e.g. C:\\my documents\\files\\file.png).
what type have you used so far? try playing with the other one. i wonder if the version of PHP used has an effect in this?
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
Replied 05 Apr 2003 20:34:21
05 Apr 2003 20:34:21 Dubya Master replied:
all the vars of the uploaded file are in $_FILES["filefieldname"]
read more @ www.php.net/manual/en/features.file-upload.php
read more @ www.php.net/manual/en/features.file-upload.php
Replied 07 Apr 2003 23:50:49
07 Apr 2003 23:50:49 Patrick Woldberg replied:
If you have selected in the serverbehaviour of the Pure PHP Upload the option Filename: Filename Only, then you can use the $HTTP_POST_VARS['filefield'] or $_POST['filefield'] depending on your php version.
In the Pure PHP Upload extension are a lot of tutorials included, you can find them under the help button.
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
In the Pure PHP Upload extension are a lot of tutorials included, you can find them under the help button.
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 19 Apr 2003 00:32:51
19 Apr 2003 00:32:51 Natalia Usselman replied:
poolio, you were right, it depends on the type of the form -
multipart/form-data is the only one that uploads a file and the only one that does not pass the proper file name to the next page replacing it with tmp/php-255 or some kind of other temporary directory.
I tried to use $_FILES and it works great - passes the proper name of the file to the next page...unless I use this damn PurePHP upload thingie.
Can someone who sold me this extention give me detailed instructions on how to pass and retrieve the file name on the next page?
Edited by - unata on 19 Apr 2003 01:01:29
Replied 19 Apr 2003 10:39:05
19 Apr 2003 10:39:05 Julio Taylor replied:
i have a great FTP-based PHP upload script which works a treat. i can send you it when i get back to work on tuesday if you like.
------------------------
Julio
PHP | MySQL | DWMX
ICQ: 19735247
MSN:
------------------------
Julio
PHP | MySQL | DWMX
ICQ: 19735247
MSN: