New topic: 

Using post to send form data... sort of

<http://forums.realsoftware.com/viewtopic.php?t=29742>

       Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic         Author  
Message       icantsing4u           Post subject: Using post to send form 
data... sort ofPosted: Wed Aug 26, 2009 12:55 am                               
Joined: Tue Dec 02, 2008 3:06 am
Posts: 58              I'm trying to upload a file via HTTPSocket. It posts the 
information to a php file, and from there the php works its php magic and the 
file should magically appear, except that I have very little experience with 
php and can't seem to figure out what's wrong.

Here's the code from the php file, blatantly stolen from a free tutorial site:
Code:<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been 
uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>


Here's the code from the HTML upload page, which works perfectly:
Code:<html>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
</body>
</html>


With an HTTPSocket, I have tried posting both the URL path and shell path of 
the FolderItem I would like to upload, but I am receiving an error each time. I 
believe it has something to do with the form enctype being 
"multipart/form-data", but again, I don't have much experience with php.

Is there something blatantly obvious that I am missing? It seems simple to me 
(set form data, post to php page, give php a blowjob while it works its 
mysterious wonders, and be happy that there's now another file on the server). 
Judging by the HTML form, it seems like all I would need to post would be a 
value for "uploaded" (via dictionary). If you see something wrong here, aside 
from me giving virtual blowjobs to php pages, please please help me out. I'll 
work on making the upload form more secure in the future, after I've finished 
reading about php.

Thansk you,
Blavey   
                            Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to