Hi all i have a problem when uploading file to flickr
if i use the following code it works:
<?php $f = new phpFlickr($api_key,$secret);
$result1 = $f->sync_upload("ico/20.jpg", $_POST["title"], $_POST["description"],
"david walsh, php, mootools, dojo, javascript, css");
?>
i try to use a form to use the following code:
<?php
if(isset($_POST['file']['name')){
$result = $token_rsp->sync_upload($_POST["file"]["name"], $_POST["title"],
$_POST["description"], "david walsh, php, mootools, dojo, javascript,
css");}
?>
it is not uploading and after i select a file to upload it opens the file dialog again (5 times).this is my form:
<form method="POST" name="zoe" enctype="multipart/form-data"
target="myiframe1">
<input type="file" style="position:absolute;left:10px;top:50px;" name="file"
id="file" value="upload"/>
<input type="hidden" name="MAX_FILE_SIZE" value="50000" />
<input type="submit" id="submit" style="position:absolute;left:10px;top:80px;"
value="Upload Imgur" />
</form>
i hope i have the right syntax because i can't get it right.
You were nearly right, but you cannot use $_POST to access files. Multipart forms send through form data in $_POST, and file uploads in $_FILES.
<?php
if(isset($_FILES['file']['name')){
$result = $token_rsp->sync_upload($_POST["file"]["name"], $_POST["title"],
$_POST["description"], "david walsh, php, mootools, dojo, javascript,
css");}
?>
Check this documentation out for more information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.