Please debug and correct my misstakes:
http://pastebin.com/m32e38cf
curl_setopt($ch, CURLOPT_INFILESIZE, $_FILES['upfile']['size']);
Makes it load forever.
Please debug and correct my misstakes:
http://pastebin.com/m32e38cf
curl_setopt($ch, CURLOPT_INFILESIZE, $_FILES['upfile']['size']);
Makes it load forever.
Last edited by galaxyAbstractor; 12-15-2008 at 03:34 PM.
yeah with that information... im not sure anyone is going to help.
If you find my post useful please add to my reputation by clicking the +Rep button
You may also use the Donate link to donate credits - this is appreciated tooThanks to those whom have donated so far!
Well. I want to be able to do a remote fileupload script to my filehost at http://datashelf.net.
Basically, the form is on another server, and the file should be sent to http://datashelf.net/upload.php and handeled.
Ok I edited a bit and managed to get some reactions:
upload.php reports "You didn't pick a file to upload"PHP Code:<html>
<head>
</head>
<body>
<?
if (!isset($_POST['file'])){
?>
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="form" method="post" style="display: inline;">
Max filesize: <b>100 MB</b><br />
<table border=0 cellspacing=0 cellpadding=2><tr><td align=center colspan=2>
<input type="file" name="upfile" size="50" style="background-color:#EEE" /></td></tr>
<tr><td align=left>
<tr><td align=center colspan=2></td></tr></table>
<p><center><input type="submit" value="Upload!" id="upload" name="file" /></center>
</form>
</body>
</html>
<?php
} else {
/* [url]http://localhost/upload.php:[/url]
print_r($_POST);
print_r($_FILES); */
$ch = curl_init();
//$data = array('name' => 'Foo', 'file' => '@C:\Users\vigge_sWe\Desktop\template\template\style.css');
curl_setopt($ch, CURLOPT_URL, 'http://datashelf.net/upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_FILES['upfile']);
curl_exec($ch);
}
?>
Last edited by galaxyAbstractor; 12-16-2008 at 02:57 PM.
I dont see this on your code:
try and tell me...PHP Code:
// you have put the dir file in your case is the tmp dir
// or try ie: http://domain.com/file.ext
$data = array('name' => 'Foo', 'file' => '@/home/user/test.png');
// pass the data
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
Last edited by tttony; 12-16-2008 at 03:19 PM.
PHP & MySQL Web Developer
Free Domain co.cc
the problem is that upload.php is recursive, you need other script.php to do something... or you can use a variable ie:
do you know I mean??curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php?save_file');
PHP & MySQL Web Developer
Free Domain co.cc
try using this part of coding:
you should change "url of file to be downloaded to the server" to the actual url
this will download the code from the site:PHP Code:curl_setopt($ch, CURLOPT_URL,"url of file to be downloaded to the server");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result= curl_exec($ch);
you'll assign
and assign it to
$result
see if this is what you want
now you may use:
to create the file and write the whole dataPHP Code:$datei = fopen("http://datashelf.net/upload.php", "w");
fwrite($datei, $result);
fclose($datei);
If you need more help just ask, if I was useful please increase my reputation
Last edited by brunoais; 12-17-2008 at 05:07 PM.