Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 3rd, 2007, 02:26 AM
Registered User
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Upload successful but no file !

Hi
I use a very simple upload script, which works ([error]=>0) but I don't find the uploaded file on server. Can anybody tell me why? O some clues?
Thanks
Ionut

 
Old August 3rd, 2007, 04:01 AM
Authorized User
 
Join Date: Mar 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to cyber_kaley20 Send a message via AIM to cyber_kaley20 Send a message via Yahoo to cyber_kaley20
Default


create the folder images

can you try this code
<?
// Script generates a unique 6 digit number, called $randomdir
// Then it makes the appropriate folder in ./temporary/$randomdir and CHMODs it 0777
// Where the file is going to be placed


if(isset($_POST['Submit'])) {
$target_path = "temporary/$randomdir/";

// Add the original filename to our target path.
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];

$target_path = "images/$randomdir/";

$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{
    die("There was an error uploading the file, please try again");
}

}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <label>
  <input type="file" name="uploadedfile" />
  </label>
  <p>
    <label>
    <input type="submit" name="Submit" value="Submit" />
    </label>
  </p>
</form>
</body>
</html>


Escaler





Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter File Types in ASP.NET File Upload ramuis78 ASP.NET 2.0 Basics 2 May 31st, 2007 10:50 AM
upload file minarojas Dreamweaver (all versions) 1 June 12th, 2006 01:31 PM
Whole Folder upload(Multi file Upload) ramasamy_rams XML 1 September 9th, 2005 12:43 PM
JSP file upload and delete file pandjie JSP Basics 0 January 29th, 2005 10:49 PM
I just want to get a successful connection Prorunner PHP Databases 1 September 28th, 2004 01:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.