MothaCuss Posted March 15, 2004 Share Posted March 15, 2004 Ok...so i'm trying to create a little webpage that allows you to upload pictures. I've gotten some code from a friend and it looks as follows: ><% Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm") If Form.State = 0 Then Form.Files.Save "C:\Uploads" Else 'Handle other form states. End If %> <body bgcolor="#FFFFFF"> <form method=post ENCTYPE="multipart/form-data"> <input type="submit" value="Upload the files >>"><br> <Div ID=files> File 1 : <input type="file" name="File1"><br> File 2 : <input type="file" name="File2"> </Div> <Input Type=Button Value="+Add a file" OnClick=Expand()> <script> var nfiles = 2; Function Expand(){ nfiles++; files.insertAdjacentHTML('BeforeEnd','<BR> File '+nfiles+' : <input type="file" name="File'+nfiles+'">'); } </Script> </Body> It's telling me this: Method Not Allowed The requested method POST is not allowed for the URL /kiwwa/test.html. I set all the permissions to allow anything and everything to be done to the website. How do i fix this or is there a better way of doing this or something? I've heard of using .asp's etc...anyone know anything bout that? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 15, 2004 Share Posted March 15, 2004 (edited) Moving to scripting forum for organization. This looks like an ASP code. I don't think ASP runs on the servers at TCH. Edited March 15, 2004 by TCH-Bruce Quote Link to comment Share on other sites More sharing options...
HCSuperStores Posted March 15, 2004 Share Posted March 15, 2004 Yeah, I see that too. Some VB Script running via ASP. Sorry my friend, that will be your first battle! You can to #includes and they do the same thing really in PHP and Perl. Quote Link to comment Share on other sites More sharing options...
MothaCuss Posted March 15, 2004 Author Share Posted March 15, 2004 Do you think that i could post from a flash file? Would that possibly work? Like...i don't understand what my overall problem is...is it the asp file type or is it my permissions in my .htaccess thats not allowing me my post method? I havent set up any post method things on my site yet so it could be permissions...though i set the folder called kiwwa to be 777. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 15, 2004 Share Posted March 15, 2004 The problem is ASP does not run on these servers. If you created something in PHP or Perl they woudl run. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 15, 2004 Share Posted March 15, 2004 Not to leave you hanging, I think this script will work for you. http://www.perlscriptsjavascripts.com/perl/upload_lite/ Quote Link to comment Share on other sites More sharing options...
DarqFlare Posted March 15, 2004 Share Posted March 15, 2004 Yeah. Bruce is right-on here. There is a way to do it in PHP as well. Quote Link to comment Share on other sites More sharing options...
MothaCuss Posted March 16, 2004 Author Share Posted March 16, 2004 Ok...now i'm getting a 500 internal server error when i try to run the script you suggested. I have my cgi-bin and upload.cgi file set to 755 so i don't know what the problem is. I set everything up correctly as far as i know...is it something you guys have to enable. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 16, 2004 Share Posted March 16, 2004 (edited) Ok, I've just uploaded and tested it and it works great. Modify the upload.cgi file for the following fields. $dir = "/home/(cpanel login)/{path-to-upload-folder}"; where you replace (cpanel login) with your login and replace {path-to-upload-folder} with where you intend the uploads to go like "public_html/uploads" $folder = "http://www.******/{upload folder}/"; Where you replace YOURDOMAIN with your domain name and {upload folder} with the folder you create to upload into $max = 200; With how big a file in kilobytes you will allow $domain = "YOURDOMAIN"; Enter your domain for YOURDOMAIN $notify = 'YOUR EMAIL ADDRESS'; Enter your email address That's all that needs modified in the upload.cgi script. Save it and upload it to your cgi-bin folder and change file permissions to 755 Now modify the demo.html file and modify the path to the upload.cgi file form action="http://www.******/cgi-bin/upload.cgi" Now save and upload that file to your webspace. Now create the folder you told the script to use in the proper path on the server. I created an uploads folder in my public_html folder and changed the permissions of the folder to 777. Test the script it should work. If you did all that, did you upload the upload.cgi file in ASCII mode or Binary? It must be uploaded in ASCII mode for it to work. Edited March 16, 2004 by TCH-Bruce Quote Link to comment Share on other sites More sharing options...
MothaCuss Posted March 16, 2004 Author Share Posted March 16, 2004 Well i did all you said and it still doesn't work. I uploaded it through the cpanel file control thing...would that effect it? It still gives me the 500 internal server error but i have everything set right. Maybe i'm not doing the form part right? You just put what file you want to upload right? Edit: I'm not retarded either haha. I know a bit about php and scripting so i didn't make any overt errors as far as i know. Quote Link to comment Share on other sites More sharing options...
boxturt Posted March 16, 2004 Share Posted March 16, 2004 I would use FTP (not cpanel) and upload in ascii. Also - don't edit it in cpanel either. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 16, 2004 Share Posted March 16, 2004 (edited) I'm not sure the cpanel upload will upload the file in ASCII or not. Like Ty says, use an FTP client and force it to upload in ASCII. I also failed to mention the last config section where you edit in the extensions of the files you will allow to be uploaded. Make sure the file's extension you are uploading is included in the upload.cgi on a separate line. Edited March 16, 2004 by TCH-Bruce Quote Link to comment Share on other sites More sharing options...
alexfung Posted March 17, 2004 Share Posted March 17, 2004 Robert, where can I find a PHP sample? Quote Link to comment Share on other sites More sharing options...
TCH-Dick Posted March 17, 2004 Share Posted March 17, 2004 I use a PHP uploader script that works really well and is easy to set up. Heres the link to it running on one of my sites http://www.moddersforum.com/imagehosting/ And heres the link to where you can get it http://celerondude.com/index.php?a=s&id=1 Quote Link to comment Share on other sites More sharing options...
DarqFlare Posted March 17, 2004 Share Posted March 17, 2004 Yeah, there ya go. Mike's got it for you. Actually, if I was to give you an example of uploading in PHP, I'd have to give you my own code.. I ended up researching it myself for a couple of uses I needed uploading for on my website. Quote Link to comment Share on other sites More sharing options...
alexfung Posted March 18, 2004 Share Posted March 18, 2004 Thanks Mike and Robert Quote Link to comment Share on other sites More sharing options...
kajoiner Posted March 19, 2004 Share Posted March 19, 2004 I am just trying to set up a page where members could upload pictures as well. I have tried several different scripts, but they all fail. I do not get any real error messages, they just will not upload the pictures. Could this be because I have modified the .htaccess for aMember? If not, is there something I need to change? I have the permissions of the folder to post to set at 777. Here is the information from the .cgi file. $dir = "/home/ndycnua/public_html/photos/pictures"; $folder = "http://www.bsatroop98.org/photos/pictures"; $max = 500; $domain = "www.bsatroop98.org"; $redirect = "/localhost/photos/index.html"; $notify = 'kajoiner@bsatroop98.org'; $send_mail_path = "/ndycnua/sbin/sendmail"; $smtp_path = "mail.bsatroop98.org"; Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 19, 2004 Share Posted March 19, 2004 (edited) $folder = "http://www.bsatroop98.org/photos/pictures"; Try adding a trailing slash to this line: $folder = "http://www.bsatroop98.org/photos/pictures/"; $send_mail_path = "/ndycnua/sbin/sendmail"; Shouldn't the path be /usr/sbin/sendmail Edited March 19, 2004 by TCH-Bruce Quote Link to comment Share on other sites More sharing options...
kajoiner Posted March 19, 2004 Share Posted March 19, 2004 I made those changes and this is the result. Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@bsatroop98.org and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. -------------------------------------------------------------------------------- Apache/1.3.29 Server at www.bsatroop98.org Port 80 Quote Link to comment Share on other sites More sharing options...
kajoiner Posted March 19, 2004 Share Posted March 19, 2004 I looked in the error log and this entry was there. error: file is writable by others: (/home/ndycnua/public_html/photos/cgi-bin/upload.cgi) Mean something to you? Quote Link to comment Share on other sites More sharing options...
kajoiner Posted March 19, 2004 Share Posted March 19, 2004 I changed the permission on the .cgi file and retried. I received this error. Invalid referrer. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 20, 2004 Share Posted March 20, 2004 Permissions of the cgi script should be 755 Not sure what would cause the invalid referrer. Have you looked at the script I mentioned above? http://www.perlscriptsjavascripts.com/perl/upload_lite/ And the configuration instructions I posted above? This script does work. Quote Link to comment Share on other sites More sharing options...
kajoiner Posted March 20, 2004 Share Posted March 20, 2004 I found the mistake. I had $domain = "www.bsatroop98.org"; when it should have been $domain = "bsatroop98.org"; The script works great. I had to modify it to do more than 2 files at a time, but that was easy. Thanks for the help. Rock Sign Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 20, 2004 Share Posted March 20, 2004 Glad you got it working. The above mentioned script will also upload a file with the same filename and rename it with a number appended. Something to think about if the script you are using doesn't check for this and just overwrites a file already uploaded. Quote Link to comment Share on other sites More sharing options...
kajoiner Posted March 23, 2004 Share Posted March 23, 2004 This script seems to be working fine for the most part, but I did find one problem that I don't know how to fix. I made a small change to the script to change the number that could be uploaded at one time from 2 files to 10 files. That change works fine, but if there is an error in any of the 10 files (ie, one of the files is too large), it returns an error for the one file but does not upload the other 9 files. Is there someway to correct this? The user that recieved the error thought that the other 9 files were uploaded because he did not recieve and error on them. Quote Link to comment Share on other sites More sharing options...
MothaCuss Posted March 24, 2004 Author Share Posted March 24, 2004 Ok...this is getting extremely annoying. It still doesn't work. Here is my code: $dir = ""/home/freecit/kiwwa";"; $folder = "http://www.freecityskates.com/kiwwa/"; $max = 2000; $domain = "freecityskates.com"; $redirect = "http://www.freecityskates.com/index.html"; $notify = 'brett@freecityskates'; $send_mail_path = "/usr/sbin/sendmail"; $smtp_path = "mail.freecityskates.com"; The permissions of the cgi-bin, the upload.cgi, and the "kiwwa" folder are all set to being 755. I can see nothing wrong with my code and i am only trying to upload files that are with the right extension. I keep getting 500 Internal Server errors....WHY!?!? This makes no sense!!! Is there something else that could be interfering? Some other permissions or files that don't allow this script to worK?? These are all the errors in my error log from my attempts at uploading... [2004-03-24 12:32:08]: error: file has no execute permission: (/home/freecit/public_html/cgi-bin/upload.cgi) [Wed Mar 24 12:46:12 2004] [error] [client 128.233.107.55] Premature end of script headers: /home/freecit/public_html/cgi-bin/upload.cgi [Wed Mar 24 12:36:40 2004] [error] [client 128.233.107.55] Premature end of script headers: /home/freecit/public_html/cgi-bin/upload.cgi [Wed Mar 24 12:36:30 2004] [error] [client 128.233.107.55] Premature end of script headers: /home/freecit/public_html/cgi-bin/upload.cgi [Wed Mar 24 12:34:39 2004] [error] [client 128.233.107.55] Premature end of script headers: /home/freecit/public_html/cgi-bin/upload.cgi [Wed Mar 24 12:34:09 2004] [error] [client 128.233.107.55] Premature end of script headers: /home/freecit/public_html/cgi-bin/upload.cgi [Wed Mar 24 12:32:08 2004] [error] [client 128.233.107.55] Premature end of script headers: /home/freecit/public_html/cgi-bin/upload.cgi Anyone know what this means? Quote Link to comment Share on other sites More sharing options...
kajoiner Posted March 24, 2004 Share Posted March 24, 2004 $dir = ""/home/freecit/kiwwa";"; $folder = "http://www.freecityskates.com/kiwwa/"; $max = 2000; $domain = "freecityskates.com"; $redirect = "http://www.freecityskates.com/index.html"; $notify = 'brett@freecityskates'; $send_mail_path = "/usr/sbin/sendmail"; $smtp_path = "mail.freecityskates.com"; I had some problems with this as well, so I am no expert, but I think you need to change the following. $dir = "/home/cpanel login name/public_html/kiwwa/"; - I think you have too many "s Take out the redirect for now. I had several problems with that and found it easier to leave that out until I worked out the other problems. Try that and see what it does. Quote Link to comment Share on other sites More sharing options...
MothaCuss Posted March 24, 2004 Author Share Posted March 24, 2004 ...it works. It was either the stupid domain not liking me or the fact that i didn't put in public_html. This lack of sleep is really killing me. Thx so much to everyone who helped out, i appreciate it tons. Rock Sign Quote Link to comment Share on other sites More sharing options...
kajoiner Posted March 25, 2004 Share Posted March 25, 2004 This script seems to be working fine for the most part, but I did find one problem that I don't know how to fix. I made a small change to the script to change the number that could be uploaded at one time from 2 files to 10 files. That change works fine, but if there is an error in any of the 10 files (ie, one of the files is too large), it returns an error for the one file but does not upload the other 9 files. Is there someway to correct this? The user that recieved the error thought that the other 9 files were uploaded because he did not recieve and error on them. Any help? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.