|
#1
|
|||
|
|||
|
File Upload through HTTP.Submit Action
I've been trying to use the HTTP.Submit action to upload a file into a Web Server. There were some issues with the HTTP.Submit action before, and it has been resolved as per the release of latest version.
Now my problem is, I can't still use this action to upload the file into the Web Server. Is this really possible with this action or not? I've tried using an HTTP activeX before which achieve the desired result. The activeX was also using HTTP Protocol so I am assuming that this should also be possible with HTTP.Submit. If it is not possible, this will be a great enhancement for the HTTP.Submit Action. Thanks, Ninj |
|
#2
|
||||
|
||||
|
Hi Ninj,
Perhaps you could post your current action so that everyone here can have a look at it and perhaps make some suggestions? What size file are you uploading? How is your Web script performing the upload? Is any part of the file being uploaded to your server? Is there an error code being returned by the HTTP.Submit() action? If so what is the error? What does HTTP.GetHTTPErrorInfo() return? I believe that you said in the past that you have gotten this to work by increasing the timeout time to a very large number, does this still hold true? Truthfully I do not see why the HTTP.Submit() action would not work in this scenario since, the action is simply passing the data to the web script, which then has to perform the actual upload task. Can you get this action to work on an empty text file?
__________________
MSI Factory The Next Generation Intelligent Setup Builder |
|
#3
|
|||
|
|||
|
Below is my script:
myValues = { filesfolder="/tu", OpCode=2, filesize=_FileSize, logfile="LogFile.txt", nameoffile="test.txt"}; SubmitFName = HTTP.Submit("http://www.mywebserver.com/cgi-bin/uploadtest.cgi", myValues, SUBMITWEB_POST, 200, 80, nil, nil); Attached is a copy of the uploadtest.cgi, in order to attach it here I renamed as .txt. As you have said, I thought that I have made it work before. However, I just noticed that the uploaded file is an empty file with 0 bytes. Therefore, the data was not really sent to the cgi, just the filename it seems. Actually, I am already using the attached cgi for another application and am trying to make the upload work in TU2 as well without having to create another cgi script. Using a 3rd party HTTP activeX, the cgi script attached is able to upload a file to the server. |
|
#4
|
||||
|
||||
|
Hi Ninj,
I tried to test this on my side but I kept getting error 2516 ("An internal server error has occurred." HTTP error code 500) when trying to test your script. This is probably because I do not have something needed installed on my server or something like that, but just to make sure do you receive any errors when you test your script? Try inserting an Application.GetLastError() after the HTTP.Submit() action and test what the results are.
__________________
MSI Factory The Next Generation Intelligent Setup Builder |
|
#5
|
||||
|
||||
|
Hello Ninj,
From what i can determine with yoru action, you're not actually passing the script any data to write into the file. A web script can't come onto your system and grab a file without permission. If you use that script through IE, IE has permission to access files on your system that you let it, and send them off to the script. Or at least that's how I understand it. But with TrueUpdate, the script can access only what values you send to it from your lua script. Thoguh i'm not positive, how I would envision a file upload working is as follows: 1. UUencode the file in trueupdate (i'm not entirely sure how to do this) 2. send the following values to your script: filename - the file, in form filename.ext filedata - the actual data, the uuencoded string 3. Create a script that accepts those two values, uudecodes the string, and writes the filestream to the specified filename on the server. I haven't tried this, but in php i'd do somethign like this (please keep in mind this hasn't been tried or tested, but is where i'd start): Code:
//save the below code into, say, upload.php and access it from trueupdate, method = post <?php //NEED POST VARIABLES: //filedata: uuencoded string of file contents //filename: string in form filename.ext $filedata = convert_uudecode($_POST['filedata']); if (!($writefilestream = fopen($_POST['filename'], 'w'))) return; fprintf($writefilestream, "%s", $filedata); ?> Lemme know how this works out for you. I've never done this, so it's kinda interesting!
__________________
Setup Factory 8.0 comes with over 250 actions so you can create smaller, faster and more intelligent software installers than ever before. WebHelp Guides: AMS | MSIFACT | SUF | TU | VP |
|
#6
|
||||
|
||||
|
Quote:
|
|
#7
|
||||
|
||||
|
oooh, that's a good point. to prevent possible errors cause of two attempts to write, right?
Is the code above correct? I'm oober new to PHP, i wasn't sure.
__________________
Setup Factory 8.0 comes with over 250 actions so you can create smaller, faster and more intelligent software installers than ever before. WebHelp Guides: AMS | MSIFACT | SUF | TU | VP |
|
#8
|
||||
|
||||
|
Here is an example of using the flock function from php.net (and a link to the page):
http://us2.php.net/flock PHP Code:
|
|
#9
|
||||
|
||||
|
FWIW if a script is hitting a single file with simultaneous writes, it's a planning issue. PHP flock wouldn't cure that because you would still be "losing" writes, i.e. if a script's author is seeking to write two pieces of data at the same time then presumably they also wish to also read them... So in that case you would just use unique temp files in a FIFO cycle.
Note from php.net: Quote:
|
|
#10
|
||||
|
||||
|
I just wanted to put forth a point with regards to using fopen, as the original poster is. Whether that was the right choice... that's up for discussion and you Corey have more PHP experience than I and have found some good counter points to using fopen.
|
|
#11
|
||||
|
||||
|
Yes I'm glad you did. This also applies to all scripting, not just PHP. In general writing twice to one file such that it would cause an error is something to plan for beforehand in all scripts/programs which write files. Common methods include using temp files or using a "flag file" to detect when another file is "ready for writing" and a corresponding file queue, etc...
|
|
#12
|
|||
|
|||
|
upload text file
I started same one in nes thread.
Last edited by mcme; 10-14-2005 at 04:07 PM. Reason: started in new thread |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 2 BUGS...Internet Download action and File Search Action | Martin_SBT | AutoPlay Media Studio 4.0 | 3 | 07-08-2003 09:30 AM |
| HOWTO: "Hide" Externally Referenced Files | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-23-2002 04:19 PM |
| INFO: Tips for Debugging Action Lists in AutoPlay Media Studio 4.0 | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-03-2002 09:38 AM |
| SUF6.0.0.2 -- installer hangs. | jassing | Setup Factory 6.0 | 4 | 12-20-2001 12:28 AM |
| Install only into one of several directories with specific existing file? | RichardShaw | Setup Factory 5.0 | 0 | 08-17-2000 03:29 PM |
All times are GMT -6. The time now is 07:38 PM.






Linear Mode

