File Upload Problem

I have the next code:

[php]

Choose file to upload:

<?php $errors = array(); $uploads_dir = '/upload'; $name = $_FILES['myfile']['name']; $type = $_FILES['myfile']['type']; $size = $_FILES['myfile']['size']; $temp = $_FILES['myfile']['temp_name']; $error = $_FILES['myfile']['error']; move_uploaded_file($temp, "$uploads_dir/$name"); ?>

[/php]

THE UPLOAD FOLDER CALLED UPLOAD
BUT IT ISNOT UPLOADING NOTHING
ANY IDEAS?
THANKS

here is fixed code

[php]

<?php $errors = array(); $uploads_dir = 'upload'; $name = $_FILES['myfile']['name']; $type = $_FILES['myfile']['type']; $size = $_FILES['myfile']['size']; $temp = $_FILES["myfile"]["tmp_name"]; $error = $_FILES['myfile']['error']; move_uploaded_file($temp,$uploads_dir."/".$name); ?>

[/php]

i found 2 mistakes

  1. [“tmp_name”] not [‘temp_name’]
  2. you forgot the slash here $uploads_dir."/".$name also i removed the forward slash from $uploads_dir

WILSON382
Thank You So much.
Its uploading
Work
PERFECT!

You welcome
Glad that i helped

Sponsor our Newsletter | Privacy Policy | Terms of Service