|
| |
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 19:41:39
Hi, so I want to use this code now. http://codewalkers.com/seecode/192.html It all seems fine. I think I can do it now after learning a little bit using cutenews. One question, when I insert this html into my page, in the preview I' m getting this garbage all around the form button: " 0) print " Your file(s) has been uploaded. " ; print " " ; for($i=0;$i<$numoffile;$i++) { print " " ; } print " " ; print " " ; ?> any idea why?
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/12/2003 20:40:23
quote:
" 0) print " Your file(s) has been uploaded. " ; print " " ; for($i=0;$i<$numoffile;$i++) { print " " ; } print " " ; print " " ; ?> your code ^ compared to the code from the link... if (isset($j)&&$j>0) print " Your file(s) has been uploaded.<br>" ;
print " <form method=' post' enctype=' multipart/form-data' >" ;
for($i=0;$i<$numoffile;$i++) {
print " <input type=' file' name=' myfiles[]' size=' 30' ><br>" ;
}
print " <input type=' submit' name=' action' value=' Upload' >" ;
print " </form>" ;
?>
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 21:10:29
Can you do me a favor? Insert this code into a blank page, look at it in the preview pane. Is that garbage coming up next to the button? Is it because I' . viewing it not in a browser? Thanks <?php /*********************************************** * Snippet Name : File Uploader * * Scripted By : Hermawan Haryanto * * Website : http://hermawan.dmonster.com * * Email : hermawan@dmonster.com * * License : GPL (General Public License) * ***********************************************/ $numoffile = 5; // Fix path of your file to be uploaded, don' t forget to CHMOD 777 to this folder $file_dir = " /home/webs/dmonster.com/subdomain/files/" ; if ($_POST) { for ($i=0;$i<$numoffile;$i++) { if (trim($_FILES[' myfiles' ][' name' ][$i])!=" " ) { $newfile = $file_dir.$_FILES[' myfiles' ][' name' ][$i]; move_uploaded_file($_FILES[' myfiles' ][' tmp_name' ][$i], $newfile); $j++; } } } if (isset($j)&&$j>0) print " Your file(s) has been uploaded.<br>" ; print " <form method=' post' enctype=' multipart/form-data' >" ; for($i=0;$i<$numoffile;$i++) { print " <input type=' file' name=' myfiles[]' size=' 30' ><br>" ; } print " <input type=' submit' name=' action' value=' Upload' >" ; print " </form>" ; ?>
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 21:12:11
I answered my oen question. No, it still came up in the browser. I dont understand why though.
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 21:30:15
Hi again, I' m at it again. I still have the junk, went to the server and changed permissions. Do I have to change permissions for every folder in the root? For example, if its /home/intered/public_html_documents do I have to change permissions for them all? I did but it still isnt working. I' m getting this " Method Not Allowed The requested method POST is not allowed for the URL /testform.htm."
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 22:17:36
In the directions for the code, it says " 2. Make sure that directory is not under your web visitor directory." Is the web visitor directory the public_html directory? If so, where should Iput it and where shoudl I put the page that the form code is in? i think that this is my problem right now.
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/13/2003 11:56:40
quote:
The requested method POST is not allowed for the URL /testform.htm." This is saying that you don' t have permission to " POST" or write to the file. Check the permissions and the path again. I just made that script work on a site from the code you posted, and there is no " garbage" . What HTML package are you using? I just pasted it into a new page in FP, changed the path, and then saved it as a PHP file. quote:
Is it because I' m viewing it not in a browser? Thanks PHP needs to be " served" by a web server. To test the code, it needs to be on the server or on a staging server somewhere....
< Message edited by caywind -- 5/13/2003 12:01 PM >
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/13/2003 19:34:23
Man, i appreciate your help. IN that last posting I learned 2 things from you that I had overlooked. First, I inserted the code, I didnt paste it. Second, I didnt name the page .php I guess thats what you meant by naming it php. Could I take a look at the page that you made just to view the source as an example for my page? I think I am on the verge of getting this to work.
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/13/2003 21:24:34
Hi again, its unbelievable. Its working! That last post from you taught me just what I didn' t know. i fixed the path and renamed it .php and it worked. I even put it into two different directories to test it and it worked fromeither a private folder or the _public.html one. One one problem remains. When I go to my file manager of my server, I can see the file. But,,,,,,, I cant seem to open it or get it. It says permission denied to access it. Any ideas what is stopping that? I 777' d the folder that I have the documents going into. wr
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/13/2003 23:37:55
another good question. That one I' m not sure about. Might have to FTP them back to yourself. Are you using cpanel (linux)? I have no idea what the code looks like since I used FP to install this script, and there is no formatting. http://www.awebmasters.net/news/test.php
< Message edited by caywind -- 5/13/2003 11:45 PM >
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/14/2003 0:37:26
Hi, my page looks like yours. Its working great! I even customized it a little bit. Yes, I' m using cpanel (linux) I will look into the ftp possibilities. I was able to open my web from the site in Fp and see the uploaded files then drag them to my desktop. But, they came out as html. Not a total loss, still workable. thanks a ton for all of the help on this. Too bad we cant figure out how to make that code email the uploaded stuff to us.
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/14/2003 3:08:22
Yeah, I couldn' t get them back down to me from cpanel. I did test it a little. MAC ie4.0 OK (thats a good thing) ie5.0 OK NN4.05 OK PC ie6,5 OK NN6.2 OK could use some validation.....
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/14/2003 20:16:22
Yeah, I need to ask my server admin about this. This could be a problem in the future. By the way, what are you refering to? Are you talking about how your page works with mac etc? You wrote: MAC ie4.0 OK (thats a good thing) ie5.0 OK NN4.05 OK PC ie6,5 OK NN6.2 OK could use some validation.....
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/14/2003 21:51:41
Browser tests. Validation would be something like being able to limit the types of files that can be uploaded.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|