Re: Uploading files to FTP via dialog
- From: Erwin Moller <since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx>
- Date: Wed, 07 Jun 2006 13:07:45 +0200
Alan wrote:
Hi,
I'm pretty new to PHP so apologies if this is an obvious question. I'm
writing the back-end of a site for a friend. The idea is that the user
adds a 'case study' to the database -- one of the fields is to display
an image. Currently I just have it so that the user needs to upload the
image himself to the FTP, then enter the path (e.g.
'images/picture.jpg') in the 'Image' field of my table.
To improve on this, I'm trying to get it so that when the user's
entering a new case study, in the 'Image' field I have a Browse button
so he can select his file. This file-path is then passed to the
'addcase.php' page which should then automatically upload the file to
the FTP.
So at the moment I have a form like this:
<form id="addnews" action="addcase.php" method="post">
<table>
<tr>
<td>Title</td>
<td><input name="title" type="text" size="50"
maxlength="150" /></td>
</tr>
[...]
<tr>
<td>Image link</td>
<td><input name="image" type="file" size="50"
maxlength="80"></td>
<tr>
<td valign="top"> </td>
<td><input name="submit" type="submit" value="Submit Case
Study" /></td>
</tr>
</table>
</form>
My problem is that after selecting a file from the local computer (e.g.
"C:\Documents and Settings\...\picture.jpg"), what is passed to
'addcase.php' when the form is submitted is ONLY the filename
("picture.jpg") without the full path before it, which I need to upload
the file to the FTP.
Sorry for the long post. If anyone can help I'd be very grateful.
Alan
Hi Alan,
The path is NOT send, only the filename AND the file.
The location of a file on the local filesystem is considered a private
matter.
How to solve?
1) You could make it a text-field, and let the client type in there the
whole path.
2) Just use it as it was ment to, that is:
- upload the file to the server as you do now.
- place the uploaded file in the appropriate directory.
For details check www.php.net and look up fileupload.
Regards,
Erwin Moller
.
- Follow-Ups:
- Re: Uploading files to FTP via dialog
- From: Alan
- Re: Uploading files to FTP via dialog
- References:
- Uploading files to FTP via dialog
- From: Alan
- Uploading files to FTP via dialog
- Prev by Date: Uploading files to FTP via dialog
- Next by Date: Re: Problem while sending attachments using php mail function
- Previous by thread: Uploading files to FTP via dialog
- Next by thread: Re: Uploading files to FTP via dialog
- Index(es):