Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Where do PHP uploaded images go to
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Where do PHP uploaded images go to
Where do PHP uploaded images go to
13-09-2007 2:02 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hi
when using php script to handle uploaded images, where do the images go?
I am trying to give my site visitors the option to submit images so i have created a simple form that submits the selected image to an 'upload.php' script
in the script, i've set the destination directory to "uploads/" and used the following code to check the uploaded file
This line of code always returns true but the image is nowhere to be found!
Where has it gone?
any answers would be greatly appreciated
Thanks
when using php script to handle uploaded images, where do the images go?
I am trying to give my site visitors the option to submit images so i have created a simple form that submits the selected image to an 'upload.php' script
in the script, i've set the destination directory to "uploads/" and used the following code to check the uploaded file
if (is_uploaded_file($_FILES['imagefile']['tmp_name']))
This line of code always returns true but the image is nowhere to be found!
Where has it gone?
any answers would be greatly appreciated
Thanks
Message 1 of 5
(1,877 Views)
4 REPLIES 4
Re: Where do PHP uploaded images go to
13-09-2007 2:10 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Have you read this?
I'd help more but, for now, my cat has decided the keyboard is a good place to lie down (needed to push her about to type this message!)
I'd help more but, for now, my cat has decided the keyboard is a good place to lie down (needed to push her about to type this message!)

Message 2 of 5
(464 Views)
Re: Where do PHP uploaded images go to
13-09-2007 2:38 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
thanks for your help mike
in the short time since i posted this i have found the simplest of solutions.
this is rough but it works perfectly well and it couldn't be easier.
it's almost to easy to be true
in the short time since i posted this i have found the simplest of solutions.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="file" name="imagefile">
<br>
<input type="submit" name="Submit" value="Submit">
<?php
if(isset( $Submit )) {
//If the Submitbutton was pressed do:
if ($_FILES['imagefile']['type'] == "image/gif"){
copy ($_FILES['imagefile']['tmp_name'], "uploads/".$_FILES['imagefile']['name'])
or die ("Could not copy");
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
} else {
echo "<br><br>";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>";
}
}
?>
</form>
</body>
</html>
this is rough but it works perfectly well and it couldn't be easier.
it's almost to easy to be true
Message 3 of 5
(464 Views)
Re: Where do PHP uploaded images go to
13-09-2007 5:44 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Actually that's hard. Just use move_uploaded_file()
Files are uploaded as temporary files to the servers /tmp directory from where you can move them to your local (server) storage using move_uploaded_file(). See the php.net website for how to use it.
Files are uploaded as temporary files to the servers /tmp directory from where you can move them to your local (server) storage using move_uploaded_file(). See the php.net website for how to use it.
Message 4 of 5
(464 Views)
Re: Where do PHP uploaded images go to
14-09-2007 10:56 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks Peter
I understand the move_uploaded_file() function a bit better now and it seems to be working.
This function suits me better anyway because stage 2 of my process is me moving the images to their new permanent location.
Users upload their images to the temp directory and they stay there until i have vetted them. I then use this function again to upload them to the gallery
I understand the move_uploaded_file() function a bit better now and it seems to be working.
This function suits me better anyway because stage 2 of my process is me moving the images to their new permanent location.
Users upload their images to the temp directory and they stay there until i have vetted them. I then use this function again to upload them to the gallery
Message 5 of 5
(464 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Where do PHP uploaded images go to