smithmr8 Posted January 7, 2008 Share Posted January 7, 2008 Howdy, I am trying to make use of an upload script found on the internet. It just returns 'Error', when I try to use it. The Form <?php include('header.php'); ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form action="upload_template_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><strong>Single File Upload </strong></td> </tr> <tr> <td>Select file <input name="ufile" type="file" id="ufile" size="30" /></td> </tr> <tr> <td align="center"><input type="submit" name="Submit" value="Upload" /></td> </tr> </table> </td> </form> </tr> </table> <?php include('footer.php'); ?> The Script <?php ('config.php') ?> <?php //set where you want to store files //in this example we keep file in folder upload //$HTTP_POST_FILES['ufile']['name']; = upload file name //for example upload file name cartoon.gif . $path will be upload/cartoon.gif $path= "/templates/".$HTTP_POST_FILES['ufile']['name']; if($ufile !=none) { if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path)) { echo "Successful<BR/>"; //$HTTP_POST_FILES['ufile']['name'] = file name //$HTTP_POST_FILES['ufile']['size'] = file size //$HTTP_POST_FILES['ufile']['type'] = type of file echo "File Name :".$HTTP_POST_FILES['ufile']['name']."<BR/>"; echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; echo "<img src=\"$path\" width=\"150\" height=\"150\">"; } else { echo "Error"; } } ?> The folder I am trying to upload to is called templates, and is located in the same place as this script. Thanks, Luke Quote Link to comment https://forums.phpfreaks.com/topic/84919-solved-upload-script/ Share on other sites More sharing options...
smithmr8 Posted January 7, 2008 Author Share Posted January 7, 2008 Sorry. It was just a mis-typed path. The '/' at the start was causing the error. Luke Quote Link to comment https://forums.phpfreaks.com/topic/84919-solved-upload-script/#findComment-432959 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.