upload

Tumblr API - how to upload multiple images to a Photoset

余生颓废 提交于 2019-12-28 12:14:42
问题 I am able to upload one picture but I can't create a photoset with multiple images using API. Documentation says: Paramater: Array (URL-encoded binary contents) One or more image files (submit multiple times to create a slide show) Does anyone know how to do it? 回答1: It's kind of a painful process, but I figured it out after studying the python code Tumblr posted. In short, it requires getting the hexadecimal for the photo and then doing some substitutions. I've created a simple iOS / iPad /

Automatically trimming an mp3 in PHP

*爱你&永不变心* 提交于 2019-12-28 05:10:45
问题 Are there any ways to automatically trim an MP3 uploaded to a website to 30 seconds (or some other length) in PHP? If not, is there any good 3rd party services that could be integrated (transparently to the user) to achieve the same effect? Thanks. 回答1: You could try the MP3 Class on PHPClasses. It features the following example: require_once './class.mp3.php'; $mp3 = new mp3; $mp3->cut_mp3('input.mp3', 'output.mp3', 0, -1, 'frame', false); In this case, the 'frame' can be substituted with

Rename a file if already exists - php upload system

蹲街弑〆低调 提交于 2019-12-28 04:27:41
问题 I this PHP code: <?php // Check for errors if($_FILES['file_upload']['error'] > 0){ die('An error ocurred when uploading.'); } if(!getimagesize($_FILES['file_upload']['tmp_name'])){ die('Please ensure you are uploading an image.'); } // Check filesize if($_FILES['file_upload']['size'] > 500000){ die('File uploaded exceeds maximum upload size.'); } // Check if the file exists if(file_exists('upload/' . $_FILES['file_upload']['name'])){ die('File with that name already exists.'); } // Upload

Best Practices for uploading files to database

北战南征 提交于 2019-12-28 04:15:08
问题 I am looking for any best practices or ideas on how you would create an interface with a DB from a .NET web application to upload data from Excel files Should I use a mechanism that allows all the records to be loaded and flags the errors or should I use a mechanism that stops the load when an error occurs. I've never had to deal with this type of requirement before so any help would be super! Thanks 回答1: If data integrity in your DB is important, do not allow data to be imported that has

What's the best way to create a single-file upload form using PHP?

梦想与她 提交于 2019-12-28 03:20:08
问题 I've found a few samples online but I'd like to get feedback from people who use PHP daily as to potential security or performance considerations and their solutions. Note that I am only interested in uploading a single file at a time. Ideally no browser plugin would be required (Flash/Java), although it would be interesting to know the benefits of using a plugin. I would like to know both the best HTML form code and PHP processing code. 回答1: File Upload Tutorial HTML <form enctype="multipart

How do you upload a file to an FTP server?

痴心易碎 提交于 2019-12-28 01:52:48
问题 I created a function to download files from an FTP server that I have access to. How would I upload files back to the FTP server? Below is the download_files method i used: public static void download_files(String un, String pw, String ip, String dir, String fn, String fp){ URLConnection con; BufferedInputStream in = null; FileOutputStream out = null; try{ URL url = new URL("ftp://"+un+":"+pw+"@"+ip+"/"+dir+"/"+fn+";type=i"); con = url.openConnection(); in = new BufferedInputStream(con

PHP see only 20 uploading files at a time

廉价感情. 提交于 2019-12-28 01:30:10
问题 When I try to upload more than 20 files at a time, then the web server see only first 20. Any other files are just ignored. What is the problem? Simple code to try: <form action="index.php" method="post" enctype="multipart/form-data"> <?php if($_FILES){ print_r($_FILES); } else{ for($i = 0; $i < 30; $i++) { echo '<input type="file" name="file'.$i.'"><br/>'; } } ?> <input type="submit" value="go"> </form> print_r() output: Array ( [file0] => Array ( [name] => 39442.jpg [type] => image/jpeg

AngularJS: Upload files using $resource (solution)

我的未来我决定 提交于 2019-12-27 17:08:38
问题 I'm using AngularJS to interact with a RESTful webservice, using $resource to abstract the various entities exposed. Some of this entities are images, so I need to be able to use the save action of $resource "object" to send both binary data and text fields within the same request. How can I use AngularJS's $resource service to send data and upload images to a restful webservice in a single POST request? 回答1: I've searched far and wide and, while I might have missed it, I couldn't find a

How do I measure request and response times at once using cURL?

陌路散爱 提交于 2019-12-27 16:08:26
问题 I have a web service that receives data in JSON format, processes the data, and then returns the result to the requester. I want to measure the request, response, and total time using cURL . My example request looks like: curl -X POST -d @file server:port and I currently measure this using the time command in Linux: time curl -X POST -d @file server:port The time command only measures total time, though - which isn't quite what I am looking for. Is there any way to measure request and

How do I measure request and response times at once using cURL?

人走茶凉 提交于 2019-12-27 16:07:33
问题 I have a web service that receives data in JSON format, processes the data, and then returns the result to the requester. I want to measure the request, response, and total time using cURL . My example request looks like: curl -X POST -d @file server:port and I currently measure this using the time command in Linux: time curl -X POST -d @file server:port The time command only measures total time, though - which isn't quite what I am looking for. Is there any way to measure request and