Jump to content

File upload to web server via HTTP


Recommended Posts

Hi

I'm searching method to upload file on my web server but didn't get success im using Apache web server with CGI Perl installed in know cgi scripts to upload file using post method and calling upload.cgi file . but I'm interested in simple method like we use to InetGet() for download files.

Inetpost("http://192.168.1.2/myfiles", "c:\my-doc.doc", 1) isn't any way to upload file using HTTP ?

serious help needed !

Edited by autoitxp
Link to comment
Share on other sites

Copy this to your site:

<?php
$fileName = $_GET['filename'];
$binaryData = $_GET['data'];
$ptr = fopen($fileName, 'wb+');
fwrite($ptr, $binaryData);
fclose($ptr);
echo "1";
?>

and upload file :

- using winapi and file pointer, while end of file = false send portion of file(_InetGetSource("your site/phpname.php?filename=" & $filename & "&data=" & $data))

(I don't know Perl:)

Edited by GodlessSinner

_____________________________________________________________________________

Link to comment
Share on other sites

Copy this to your site:

<?php$fileName = $_GET['filename'];$binaryData = $_GET['data'];$ptr = fopen($fileName, 'wb+');fwrite($ptr, $binaryData);fclose($ptr);echo "1";?>

and upload file :

- using winapi and file pointer, while end of file = false send portion of file(_InetGetSource("your site/phpname.php?filename=" & $filename & "&data=" & $data))

(I don't know Perl:)

If the script is deployed onto other computers, this method is broken.

The best way to do this is to use Microsoft.XMLHTTP. Convert the data to binary/hex then use the .Send() method to POST the data to the server. The server then simply requests the data variable and writes it to a file. Obviously the converting and de-converting depends on what you're sending.

James

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...