Menu

upload extension issue

Help
budershank
2007-08-03
2012-10-11
  • budershank

    budershank - 2007-08-03

    I've been working on getting phpwiki up and going for a bit now and I can't seem to get around this one issue. When I try to upload a picture I always get:

    ERROR uploading 'coolpicture.jpg':
    Only files with the extension 7z , avi , bmp , bz2 , c , cfg , diff , doc , gif , h , ini , jpeg , jpg , kmz , mp3 , patch , pdf , png , ppt , rar , tar , tar.gz , txt , xls , zip are allowed.

    I played around with the allowed file types for a bit, by adding like '.jpg' and it didn't help, tried different file formats, like bmp and mp3 and I get the same issue. I also set the config.ini DISABLE_UPLOAD_ONLY_ALLOWED_EXTENSIONS and it let me upload the files but then I couldn't actually get the pictures I uploaded to display, offsite ones would load just fine but the uploaded ones would give a link with a ?.

    So anyone have some ideas? It's possible I was close when i disabled upload only allowed extensions and just messed up inserting the picture.

     
    • Vivek Mittal

      Vivek Mittal - 2007-10-13

      Did you manage to get this resolved. I am experiencing the same problem when running the latest version of phpWiki.

      After setting DISABLE_UPLOAD_ONLY_ALLOWED_EXTENSIONS to true, I am able to upload, but cannot read the files.

      The URL generated is http://<hostname>//uploads/VivekMittal/Book.pdf, but I can't access this from a browser. The actual file has been uploaded to a folder called uploadsVivekMittal, not in a subfolder of uploads as the URL suggests. Finally, the file permissions are set to 600 and not 644.

      Can someone help with these issues.

       
      • Harold Hallikainen

        I had a problem with uploads not going into the user directory. Instead, an upload would go into a directory like uploadsHarold instead of uploads/Harold . Based on a solution posted in the forums, I did the following. It works now.

        In lib/plugin/UpLoad.php I modified the line as shown below:

           $file_dir = getUploadFilePath() . '/';  // added slash. hh 9/8/07
        

        Good luck!

        Harold

         
        • Vivek Mittal

          Vivek Mittal - 2007-10-13

          Harold,

          Thank you for your help. I have made the changes as suggested and moved forward a bit. I also found that the files were being created with permission 600 instead of 644. So, I also added the line to chmod just before the line that calls the interwiki as below.

                      chmod($file_dir . $userfile_name, 0644);
                      $interwiki = new PageType_interwikimap();
          

          Uploads now work in a usable manner. Still don't know why the "enable allowed extensions only" does not work, but it doesn't matter.

          Thanks.

          Vivek

           
          • Harold Hallikainen

            I changed the owner of the upload directory (and everything else, I think) to apache so apache could read and write it. Also, the "allowed extensions" is working for me. I think I'm the one that caused that to be added to the code when someone planted a script on my system with the extension php3. It was not one of the disallowed extensions, so it was allowed to run. i really encourage you to do what you can to use allowed extensions instead of disallowed extensions.

            Good luck!

            Harold

             

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.