SitePoint Sponsor

User Tag List

Page 2 of 8 FirstFirst 123456 ... LastLast
Results 26 to 50 of 181
  1. #26
    lei
    SitePoint Community Guest
    Very useful guide. However, when I run it on my web server, upload some image file and click "submit form", I can't see the Thanks info. Weirdly, I can see the entire upload.cgi file in the explorer window. What's going on?

  2. #27
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lei,

    Your web server hasn't been set up properly to run CGI scripts. It's just serving the upload.cgi file as if it's a plain text file.

    You need to tell your web server that it should treat files ending in .cgi as Perl scripts and execute them, rather than serve them as files.

    Hope that helps

    Cheers,
    Matt

  3. #28
    maslow
    SitePoint Community Guest
    it could be the path settings in the upload.cgi file.

    you can change the <img src> line in the cgi script to this to remove the worry:

    <img src="$upload_dir/$filename" border="0">

    It could also be the chmod setting.

  4. #29
    Jim
    SitePoint Community Guest
    Hi, I'm a novice at server-side scripting and I've a site on Unix / Linux server so I guess I need to make the PERL excecutable. But do I add the (chmod a+rx or chmod 755 ) to the file name, of does that go within the actual script somewhere.

    I was also wondering how difficult it would be to create a Mp3 upload facility. Can you give me any advice?

    Thanks,

    Jim

  5. #30
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jim,

    You can make your script executable using your FTP program. There will usually be an option to "set permissions on" or "chmod" the uploaded file.

    As an MP3 is a file just like an image, you should be able to use the upload script in the tutorial to do what you need.

    Matt

  6. #31
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, I'm having the same problem as someone who posted earlier. I got the script to work but when I upload files the contents show up empty. One difference is I'm using Windows (yeah I know I wish I wasn't). And I'm hosting it on a machine myself so I have full access to apache. Any ideas? Thanks in advance.

  7. #32
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you include the " binmode UPLOADFILE; " line as described in the article? If so then you possibly have some kind of permissions problem. Make sure that the web server user is allowed to create and modify files inside your upload folder.

    Matt

  8. #33
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried adding that line and it had no impact on this problem. I'm not too sure if the permissions are set correctly.

    <Directory "C:/MATLAB701/toolbox/webserver/psws">
    AllowOverride None
    Options Indexes ExecCGI
    </Directory>

    now the actual directory I have the file uploaded to is in the path
    C:/MATLAB701/toolbox/webserver/psws/upload.

    Do the permissions get applied to all subfolders?
    Also I got rid of the "AllowOverride None" because I found out that defaults are given to folders without specific permissions.

    Thanks...

  9. #34
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just noticed something interesting...Whenever I upload a file the temporary file gets written in the documentroot directory. If you change its extension to match the file you upload it turns out to be the complete file, so that means the script does properly upload the file, it just doesnt copy it to my upload folder within documentroot. Any ideas?

  10. #35
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, so I figured it out it was this line:

    $query = new CGI->new;

    I took out ->new and it worked.

  11. #36
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried the file upload stuff in the Matt Doyle article "Uploading Files Using CGI and Perl" but there's something I'm missing. Tried it out and got "The page cannot be found". Here's what I've observed: - file did not post to the server; - URL changed to domain/upload.cgi. I'm guessing that it's not the path in the form action of the html file but rather the path in the $upload_dir in the cgi file. So, if the domain were quickbrownfox but the server root directory is Quick Brown Fox, shouldn't the $upload_dir be "/Quick Brown Fox/upload"?

  12. #37
    Jrush
    SitePoint Community Guest
    I have a problem in the upload location. my site is http://democrats.coretechnique.com/upload/ what would be the possible exact web adress? /home/coretechnique/democrats/upload ?

  13. #38
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by yodayoda
    I tried the file upload stuff in the Matt Doyle article "Uploading Files Using CGI and Perl" but there's something I'm missing. Tried it out and got "The page cannot be found".
    At what point to you get "The page cannot be found" ?

    Quote Originally Posted by yodayoda
    Here's what I've observed: - file did not post to the server; - URL changed to domain/upload.cgi. I'm guessing that it's not the path in the form action of the html file but rather the path in the $upload_dir in the cgi file. So, if the domain were quickbrownfox but the server root directory is Quick Brown Fox, shouldn't the $upload_dir be "/Quick Brown Fox/upload"?
    If you placed your upload.cgi in the cgi-bin folder then your URL in your FORM tag should be e.g. '/cgi-bin/upload.cgi', not just 'upload.cgi'.

    $upload_dir should be the full path from your server's volume root. For example, this might be '/home/username/Quick Brown Fox//htdocs/upload".

    Hope that helps...

    Matt

  14. #39
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jrush
    I have a problem in the upload location. my site is http://democrats.coretechnique.com/upload/ what would be the possible exact web adress? /home/coretechnique/democrats/upload ?
    If you mean the full filesystem path to your 'upload' directory, then it would depend on how your server's set up. Ask your web hosting company what the full path to your site's document root should be (it's probably also in their support area or web control panel if you have one). Then append '/upload' to that path.

    Cheers
    Matt

  15. #40
    Gus
    SitePoint Community Guest
    I get 0 bytes files

  16. #41
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Gus
    I get 0 bytes files
    Sounds like your files aren't getting uploaded properly. Maybe your script doesn't have permission to write to the /tmp/ directory or other temp directory, so it can't store the temporary uploaded file?

    Your server error log might give you more information as to what's going on.

    Cheers,
    Matt

  17. #42
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    ok. following your uploading script, everything works 100% (good job tho ), all my uploads get an error. ) bytes and file headers missing or whatever.

    is there anyway in your script that i can specify the temp directory?

  18. #43
    Ryan
    SitePoint Community Guest
    All works fine, except that your "putting it all together" forgot the bin mode part. My problem lies in the temp files being created by the program. Any thoughts on deleting them?

  19. #44
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Darko
    is there anyway in your script that i can specify the temp directory?
    Look for the section "You can read the name of the uploaded file, but can't retrieve the data" in the CGI.pm documentation.

    Cheers
    Matt

  20. #45
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ryan
    All works fine, except that your "putting it all together" forgot the bin mode part. My problem lies in the temp files being created by the program. Any thoughts on deleting them?
    CGI.pm should automatically remove temp upload files. However on Windows systems you might need to explicitly close the files as Windows can't delete open files. You could try adding:

    Code:
    close $upload_filehandle;
    towards the end of your upload script maybe?

    Matt

  21. #46
    jared
    SitePoint Community Guest
    I did exactly as described and I still get Internal server error.

  22. #47
    shashi_pagare
    SitePoint Community Guest
    This article was excellent

  23. #48
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks shashi_pagare

    Matt

  24. #49
    Joonil Seo
    SitePoint Community Guest
    When the binary file is uploaded you use
    binmode UPLOADFILE;
    and it works fine for the binary file in my web server.

    What is the text file option ?
    I am trying to use
    use open IN => ":crlf", OUT => ":raw";
    But my web server doesn't like it.

    Is there any option like
    binmode UPLOADFILE; for text file?

    Please give me a help.
    Thanks.



  25. #50
    SitePoint Zealot elated's Avatar
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just leave out the binmode line.

    Matt


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
  •