Menu

Uploading Files to where?

Help
tbltk
2006-01-27
2013-06-03
  • tbltk

    tbltk - 2006-01-27

    How can set where your uploaded files go? Do you have to use a database? Otherewise it says upload failed :(
    Thanx

     
    • TNTEverett

      TNTEverett - 2006-01-27

      You decide where the forms are uploaded to.  I'm not sure but I think the default is that they go into a {formname}/files folder.  You do not have to use a database.  The most common failure for uploading files is that either the folder does not exist or the folder has the wrong permissions. 

       
    • tibpin2

      tibpin2 - 2006-09-11

      i try to use files folder permisssion 777, 755, 644. No one success to saved.
      The link created just /files/08_10_16_ without name of file and file saved under that folder.
      please advise.

       
      • TNTEverett

        TNTEverett - 2006-09-11

        Folders should have a minimum of 755 in some cases they may need 777 if anyone is supposed to be able to have full rd/wr access (major security risk). 
        HTML and graphics don't need anything more than 644.  Depending on your host, PHP files should have either 755 or 644.  Try 755 first as this is the most common that I know of.  Use 644 for PHP files whenever you can. 

        Answer to your previous email in case you didn't get it:
        Here are some sections of your code.

        if($HTTP_POST_FILES['Fotocewek']['tmp_name']==""){
        }
        else if(!is_uploaded_file($HTTP_POST_FILES['Fotocewek']['tmp_name'])){
        $error.="<li>The file, ".$HTTP_POST_FILES['Fotocewek'] ['name'].", was not uploaded!"; $errors=1; }

        if($errors==1) echo $error;
        else {
        $image_part = date("h_i_s")."_".$HTTP_POST_FILES['Fotocewek']['name'];
        $image_list[0] = $image_part;
        copy($HTTP_POST_FILES['Fotocewek']['tmp_name'], "files/".$image_part);

        This is my first observation.  The second if else statement is missing the closing bracket of the else condition.  The second if else statement should read "if error, print error, else copy file".  The syntax is if (condition){ #command if true } else { #command if false } So put the closing bracket after "copy file".  The corrected code is below.

        if($HTTP_POST_FILES['Fotocewek']['tmp_name']==""){
        }
        else if(!is_uploaded_file($HTTP_POST_FILES['Fotocewek']['tmp_name'])){
        $error.="<li>The file, ".$HTTP_POST_FILES['Fotocewek'] ['name'].", was not uploaded!"; $errors=1; }

        if($errors==1) {
        echo $error;
        }
        else {
        $image_part = date("h_i_s")."_".$HTTP_POST_FILES['Fotocewek']['name'];
        $image_list[0] = $image_part;
        copy($HTTP_POST_FILES['Fotocewek']['tmp_name'], "files/".$image_part); }

        This is my second observation.  In the previous code you have assigned $image_list[0].  In later code you use the following reference.  Notice anything unusual?

        Foto cewek: ".$where_form_is."files/".$image_list[16]."

        Try changing this to
        Foto cewek: ".$where_form_is."files/".$image_list[0]."

        Do the same anywhere you find $image_list[16].

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.