Closed Thread Icon

Topic awaiting preservation: help with uploading files (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22975" title="Pages that link to Topic awaiting preservation: help with uploading files (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: help with uploading files <span class="small">(Page 1 of 1)</span>\

 
kronk
Bipolar (III) Inmate

From: Sydney, Autralia
Insane since: Jun 2004

posted posted 08-18-2004 17:48

hi there, i am trying to upload files to my server, with the following

code:
require_once("fn_sheet.php");
session_start();

$pic_file = $_FILES['pic']['name'];
$img_name = $_POST['img_name'];
$alt_name = $_POST['alt_name'];
$location = $_POST['location'];

$new_file = "images/".$location."/".$img_name.".jpg";

if(!empty($pic_file) && !empty($img_name)) {
if(copy($pic_file, $new_file)) {
echo "copy was successful";
}
else {
echo "Copy failed";
}
}
else {
echo "missing data";
}



now when i uploaded it i got an error stating that copy(blablabla) failed to open stream .....

i have tried everything but nothing works, i have read everything on php.net regarding uploads. i ran

code:
print("<pre>");
print_r($_FILES);
print("</pre>");



and got the array details, however in the error section it said: error => 2

i looked for this on php.net and couldn't find anything i could use.

anyone have any suggestions??? i been up for 3 hours on this!

---------------------------------------------------------------------------------------------------------------------
Need a web site made? don't have much $$$ to spend? I have 3 spaces to fill as I am looking to increase my portfolio! I will make your site for you.

Visit 10/6 Web Solutions today!

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-18-2004 20:07

http://www.php.net/manual/en/features.file-upload.errors.php

quote:
UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.




also you'l need to copy from $_FILES['pic']['tmp_name'] instead of $_FILES['pic']['name'].

And you should use php->is_uploaded_file() to check if $pic_file really is an uploaded file.

so long,

->Tyberius Prime

kronk
Bipolar (III) Inmate

From: Sydney, Autralia
Insane since: Jun 2004

posted posted 08-19-2004 06:09

thanks i forgot that the size was in bytes and i had no i dea why it wasnt working. i also had some issues with my insert statement... oh well all fixed now

thanks Prime

---------------------------------------------------------------------------------------------------------------------
Need a web site made? don't have much $$$ to spend? I have 3 spaces to fill as I am looking to increase my portfolio! I will make your site for you.

Visit 10/6 Web Solutions today!

« BackwardsOnwards »

Show Forum Drop Down Menu