Forums

PHP

This topic is locked

retrieve filename from PHP Upload File

Posted 21 Dec 2001 01:24:12
1
has voted
21 Dec 2001 01:24:12 A H posted:
I'm trying to build a page with an insert and upload on the same page.

Previously i have built sites like this:
-one page for the upload &
-one page for the insert record where they have to type in the filename (and get it right)

Is there a better way to do this?

I have the PHP Upload File and Insert Record on the same page - and working.

How can i retrieve/store the filename from the PHP File Upload behaviour?

I'm trying to avoid using blobs....

Thanks.

Replies

Replied 21 Dec 2001 02:42:45
21 Dec 2001 02:42:45 Tim Green replied:
The filename of the uploaded file can be retrieved via a specific variable.

The variable name actually varies depending on the name of your File field on the page.

For example, though, if the file field is called userfile, the variable that contains the name of the uploaded file is called $userfile_name. You can use this information by referring directly to this variable in the Insert Record HTML.

Hope this helps.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 21 Dec 2001 03:37:57
21 Dec 2001 03:37:57 A H replied:
Thanks Tim - you are a legend <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

The only other thing to do is append "photos/" before the filename.

Whats the correct syntax for adding text to a variable? is it something like...

&lt;?php echo photos/$photo_name ?&gt;

Thanks again,

Aaron

Replied 21 Dec 2001 11:26:07
21 Dec 2001 11:26:07 Tim Green replied:
Thanks <img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>

The correct syntax for this is:-

&lt;?php echo "photos/" . $photo_name; ?&gt;

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic