PDA

View Full Version : Help with pic uploads


behindby3
12-11-2002, 01:20 PM
As usual in the muck so i contact you guys

I have a shopping cart where i need to upload images via a form the dir i want to upload is mywebsite/shop/admin/images/ and the chmod of the image dir is 777 and name of file uploading is tspot.jpg but i get this message

Warning: Unable to create 'tspot.jpg': Permission denied in /home/behindby/public_html/shop/admin/upload_final.php on line 13
File upload error!

where do these directories come from as i do not have them on my site or I do not understand how they fit in my code????

I am very frustrated

mark :confused:

bcarl314
12-11-2002, 02:19 PM
Can you post the "upload_final.php" file. That's the name of the file that's creating the error.

The directory
/home/behindby/public_html/shop/admin
is where your upload_final.php file is on the server. My bet is that in your code you've got something like this...


$dest=mywebsite/shop/admin/images/
$src = /tmp/myfile.tmp //or something like this
copy($file, $src, $dest);


if that's the case you're trying to put the uploaded file into the
/home/behindby/public_html/shop/admin/mywebsite/shop/admin/images/

Which probably doesnt exist.

You'll need to place the file absolutly like this
$dest = /home/behindby/public_html/mywebsite/shop/admin/images

Hope this helps, posting the code would really help nail this one.

behindby3
12-11-2002, 02:36 PM
Sure here you go

<?php
// required variables
require("../config.php");
?>



<?

// if $img_name isn't empty, try to copy the file
if ($img1_name != "") {

copy("$img1", "$upload_path$img1_name")
or die("$txt_file_error!");

} else {

// if $img_name was empty, die and let us know why
die("$txt_no_file");

}

?>


<html>
<head>
<title>Upload OK</title>

<style>

A:Link {color:000000;text-decoration:none;}

A:Visited {color:000000;text-decoration:none;}

A:Hover {color:F70404;text-decoration:underline;}

</style>

</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000000" VLINK="#000000" ALINK="#F70404">

<CENTER>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><B><?php echo $txt_upload_ok ?></B></FONT>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<P><?php echo $txt_image?> <? echo "$img1_name"; ?> <?php echo $txt_uploaded ?><BR><? echo "$img1_size"; ?>
bytes type <? echo "$img1_type"; ?>.</p>
</FONT>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<B>[ <a href="javascript:self.close()"><?php echo $txt_close_window ?></a> ]</B></A></font>
</CENTER>
</body>
</html>

ConfusedOfLife
12-12-2002, 07:59 PM
I see no forms in your page!
Also I think this part is wrong :

copy("$img1", "$upload_path$img1_name")


And it should be:


copy("$img1", "$upload_path/$img1_name")



Note: I'm not sure about the $img1_name, since I don't use global variables and instead I use $_FILES, so, each index has an array that name is one of its properties.