SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Moving Uploaded excel sheet to a location in server

    I'm looking for help processing file uploads. I've got my .html form set up complete with excel file-upload field.
    All I want to do is have file saved in a folder on my server .I have got a php script which i have pasted below:
    PHP Code:
    <?php 
     $target_path 
    "uploads/";

    $target_path $target_path basename$_FILES['uploadedfile']['name']); 

    if(
    move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
        echo 
    "The file ".  basename$_FILES['uploadedfile']['name']). 
        
    " has been uploaded";
    } else{
        echo 
    "There was an error uploading the file, please try again!";
    }

     
    ?>
    I have problem modifying this code .
    My file name is InputSheet.XLSX, and the path is going to be'./data/InputSheet.xlsx'
    I am not sure about the tmp_name.
    Please modify my code such that it moves the excel into the specified path.
    If anyone could at least point me in the right direction it would help a lot!
    Thanks.
    Last edited by cpradio; Sep 6, 2013 at 10:51. Reason: Changed <code> tags to [php] tags

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    change $target_path to point to "data/".
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •