i actually want a user to select a file to upload to my webspace , and while uploading it is renamed and at end it will display a url to the user which contains php variables ( (depends on the file name) .. i have made a form (for the user to select it) and a php file(which will rename and upload it)..the code is as follows-


<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<form action="upload_rename_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<td><strong>Single File Upload </strong></td>
<td>Select file 
<input name="ufile" type="file" id="ufile" size="50" /></td>
<td align="center"><input type="submit" name="Submit" value="Upload" /></td>



// Your file name you are uploading 
$file_name = $HTTP_POST_FILES['ufile']['name'];

// random 4 digit to add to our file name 
// some people use date and time in stead of random digit 

//combine random digit to you file name to create new file name
//use dot (.) to combile these two variables

//set where you want to store files
//in this example we keep file in folder upload 
//$new_file_name = new upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "upload/".$new_file_name;
if($ufile !=none)
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
echo "Successful<BR/>";

//$new_file_name = new file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$new_file_name."<BR/>"; 
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; 
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; 
echo "Error";
echo "Execute The Following Link In Your Browser To Upload the Photo";
echo $photo;

ERROR IN THE PHP FILE IS - Parse error: syntax error, unexpected T_ECHO in XXXXXX / XXXXX / XXXX / XXXXupload_rename_ac.php on line 71

6 Years
Discussion Span
Last Post by rajdevsohail

Thank You very much ZERO13 , now it's all fine.. thanks for your help , now my website is running smoothly....

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.