-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Description
Hi shuber,
I have an upload api i use it to upload files to google cloud storage and this is the api
http://acquired-backup-198200.appspot.com/upload?uname=arun&Description=description&players=arun,sai&community=true&Location=US&skills=batting&analysis=true
I use php-curl to upload files to this api and this is the php code
`if( $_SERVER['REQUEST_METHOD'] == 'POST' ){
$file = $_FILES['files'];
$fileName = $file['name'];
$fileType = $file['type'];
$fileTmp = $file['tmp_name'];
var_dump( $file );
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://acquired-backup-198200.appspot.com/upload?uname=arun&Description=description&players=arun,sai&community=true&Location=US&skills=batting&analysis=true",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"filename\"; filename=\"". $fileName ."\"\r\nfile=\"filedir\"; filedir=\"@/home/alaa/Desktop/Cielo_estrellado_by_Eduardo_Diez_Viñuela.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
};
}`
And this is html
<form method="post" enctype="multipart/form-data"> <input type="file" name="files"> <input type="submit" name=""> </form>
The process succeed but the files in the storage are 0 bytes size so can you help me in that problem please?
Metadata
Metadata
Assignees
Labels
No labels