Hey Roonaan,
That just errors now on line 22/23
:(
Rob
Main Topics
Browse All TopicsHey,
I have a form for the administrator to use which uploads a stock image to the server. I need to rename the file based upon the value of a variable allready set called $pos
Im using the below upload code, which also creates a folder in the upload directory for the pictures of this item to be put in.
Any help woiuld be greatly appreciated as ive spent a few days trying differnt things.
Also, is it possible for it to forward to another page once the upload has been done, rather than displaying the "image upload complete" under the original page?
Cheers
Rob
////// code ///////
<html>
<head>
<title>Image Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
if ($_FILES['imagefile']['typ
if(!file_exists("../images
{
mkdir("../images/stock/pic
chmod("../images/stock/pic
}
copy ($_FILES['imagefile']['tmp
or die ("Could not copy");
echo "";
echo "Name: ".$_FILES['imagefile']['na
echo "Size: ".$_FILES['imagefile']['si
echo "Type: ".$_FILES['imagefile']['ty
echo "Copy Done....";
}
else {
echo "<br><br>";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['n
}
}
?>
<form name="form1" method="post" action="" enctype="multipart/form-da
<p>
<input type="file" name="imagefile">
<br>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks, but I get :
Fatal error: Call to undefined function: move_upload_file() in /homepages/46/d154062004/h
using this code:
// php /////
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
if ($_FILES['imagefile']['typ
if(!file_exists("../images
{
mkdir("../images/stock/pic
chmod("../images/stock/pic
}
$myNewFileName = 'something.jpg';
move_upload_file($_FILES['
echo "";
echo "Name: ".$_FILES['imagefile']['na
echo "Size: ".$_FILES['imagefile']['si
echo "Type: ".$_FILES['imagefile']['ty
echo "Copy Done....";
}
else {
echo "<br><br>";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['n
}
}
/////////////
Business Accounts
Answer for Membership
by: RoonaanPosted on 2006-03-13 at 04:07:30ID: 16173420
Change the line: _name'], "../images/stock/pictures/ $id/".$_FI LES['image file']['na me'])
imagefile' ]['tmp_nam e'], "../images/stock/pictures/ $id/".$myN ewFileName );
copy ($_FILES['imagefile']['tmp
To
$myNewFileName = 'something.jpg';
move_upload_file($_FILES['
-r-