stephmck990
03-09-2009, 03:36 PM
I want to thank you all in advance for taking the time to look over my post and try to help me out here. :)
So, I'm fairly clueless about PHP, and the only thing I have to go on are the small things I'm finding here on the web. Although, I'm having a really tough time finding exactly what I'm looking for. I've found a few posts with the same questions as mine (http://codingforums.com/showthread.php?t=23626), but none that I can really understand... :rolleyes:
Okay. We have a simple form here with a text box and a file field.
<table width="100%" height="70" border="0">
<tr>
<td height="68">
<form name="onephotoupload" enctype="multipart/form-data" method="post" action="http://customcameracollection.net/customerphotos/upload_file.php">
<div align="center"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<table width="100%" border="0">
<tr>
<td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<center>
<label>Last Name:</label>
<input name="lastname" type="text" id="lastname" size="25">
<br /><input name="uploadedfile" type="file" id="uploadedfile" size="25">
</center>
</font></td>
</tr>
<tr>
<td width="58%" align="right">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="submit" name="submit" value="Upload Photo" />
</font>
</td>
</tr>
</table>
<br />
</font></div>
</form></td>
</tr>
</table>
Now, I need a code that will take whatever the client types into the 'lastname' textbox and make it the new filename of the file that's uploaded to my FTP server. This way it would be easier for us to match up the client's photo with their order in which they placed. Each client will only be uploading one photo. No need for crazy numbers and letters and stuff.
This is the PHP I've got so far:
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
If someone could let me know the simplest way of going about doing this, I'd be incredibly grateful.
Thanks again for taking the time to help me out! :thumbsup:
So, I'm fairly clueless about PHP, and the only thing I have to go on are the small things I'm finding here on the web. Although, I'm having a really tough time finding exactly what I'm looking for. I've found a few posts with the same questions as mine (http://codingforums.com/showthread.php?t=23626), but none that I can really understand... :rolleyes:
Okay. We have a simple form here with a text box and a file field.
<table width="100%" height="70" border="0">
<tr>
<td height="68">
<form name="onephotoupload" enctype="multipart/form-data" method="post" action="http://customcameracollection.net/customerphotos/upload_file.php">
<div align="center"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<table width="100%" border="0">
<tr>
<td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<center>
<label>Last Name:</label>
<input name="lastname" type="text" id="lastname" size="25">
<br /><input name="uploadedfile" type="file" id="uploadedfile" size="25">
</center>
</font></td>
</tr>
<tr>
<td width="58%" align="right">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="submit" name="submit" value="Upload Photo" />
</font>
</td>
</tr>
</table>
<br />
</font></div>
</form></td>
</tr>
</table>
Now, I need a code that will take whatever the client types into the 'lastname' textbox and make it the new filename of the file that's uploaded to my FTP server. This way it would be easier for us to match up the client's photo with their order in which they placed. Each client will only be uploading one photo. No need for crazy numbers and letters and stuff.
This is the PHP I've got so far:
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
If someone could let me know the simplest way of going about doing this, I'd be incredibly grateful.
Thanks again for taking the time to help me out! :thumbsup: