tags:

views:

43

answers:

2

Unable to Upload file with filename with different extention in php

echo basename( $_FILES['uploadedfile']['name']);
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
 //  header("Location: EHP_Configuration.html");
 } else{
  //   header("Location: EHP_Configuration.html");
     echo "Notdone";
 }

i have verified that on Echo it show proper filename

But move_upload give me "Notdone"

Regards

A: 

Have you got error_reporting on? If so check to see if a warning is thrown, if there is no warning and you're just getting FALSE retruned then PHP doesn't think the file is a valid uploaded file (done via PHPs HTTP POST) if you are getting a warning as well as a return value of FALSE this should give some indication as to what the problem with moving the file is.

RMcLeod
File i am trying to upload....is valid file and also i want user to get restrcted to that file extension onlyit work for xlx extension
new
A: 

May be you have missed slash here:

$target_path . '/' . basename( $_FILES['uploadedfile']['name']);

I miss it all the time :)

FractalizeR
this works fine for xls file but not for .08o
new
What's the value of $target_path ?
FractalizeR