File Attributes

Last post 12-05-2013, 8:18 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  12-04-2013, 10:49 PM 78509

    File Attributes

    Hello,

     

    I am evaluating this script to add to a form in an existing app that includes certain file attributes to be stored in a SQL database. I wanted to see if there is a way I can add these attributes when a user uploads a file. It's basically just one SQL query. Another issue is that if a user uploads a file and then tries to upload another file, the second file will not have the attribute fields I need. Is there any way I can do this?

     

    Thanks,


    Drdx. 

  •  12-05-2013, 8:18 AM 78512 in reply to 78509

    Re: File Attributes

    hi drdx,

     

    1. After uploaded, you can get the upload file info like the code below, it is the server side php code, so I think you can achieve your sql code in it too.

     

    1. <?php     
    2. //Gets the GUID of the file based on uploader name     
    3. $fileguid=@$_POST["myuploader"];     
    4. if($fileguid)     
    5. {     
    6.     //get the uploaded file based on GUID     
    7.     $mvcfile=$uploader->GetUploadedFile($fileguid);     
    8.     if($mvcfile)     
    9.     {     
    10.         //Gets the name of the file.     
    11.         echo($mvcfile->FileName);     
    12.         //Gets the temp file path.     
    13.         echo($mvcfile->FilePath);     
    14.         //Gets the size of the file.     
    15.         echo($mvcfile->FileSize);      
    16.              
    17.         //Copys the uploaded file to a new location.     
    18.         $mvcfile->CopyTo("/uploads");     
    19.         //Moves the uploaded file to a new location.     
    20.         $mvcfile->MoveTo("/uploads");     
    21.         //Deletes this instance.     
    22.         $mvcfile->Delete();     
    23.     }     
    24. }     
    25. ?>   
     

    2. What is the "attribute fields" you mean? Can you explain your question in detail?

     

    Regards,

     

    Ken 

View as RSS news feed in XML