upload

Detect how long it takes for a file to upload (PHP)

霸气de小男生 提交于 2019-12-24 00:03:40
问题 Is it possible to know (serverside) the time it took for a file to upload? I have an image upload API and in my response I'd like to return the upload time (not including script execution time). 回答1: I think yes, there is $_SERVER['REQUEST_TIME'] variable that indicates the start of HTTP request, so on the very beginning of your script: $upload_time = time() - $_SERVER['REQUEST_TIME']; Result will be in seconds. 回答2: Seems this method works pretty OK actually: Send off an ajax request (right

LARAVEL - Displaying images from the storage folder

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 21:45:10
问题 I'm new to Laravel and was wondering if someone can help me out with a simple image upload. I have a form that allows a user to create a profile and upload and avatar for their profile during the process. This all works perfectly. Here is the code from my controller: if (request()->hasFile('avatar')) { $file = request()->file('avatar'); $file->storeAs('avatars/' . auth()->id(), 'avatar.jpg'); } The image is saved within storage/app/avatars/USER-ID/avatar.jpg I'm not sure how to display the

Upload a file on amazon S3 with PHP SDK

邮差的信 提交于 2019-12-23 20:59:24
问题 I'm trying to upload a file on my amazon S3 bucket via the PHP SDK. However my script doesn't work, I have a blank page without any error or exception message. EDIT : After enabled "display_error" in php.ini. I have the error message below (looks like the sdk is not working on my side). Thanks to @datasage . The problem was that aws.phar needs cURL to be installed on the machine to work. sudo apt-get install php5-curl <?php require 'aws.phar'; use Aws\S3\S3Client; use Aws\S3\Exception

APC vs pecl uploadprogress

旧城冷巷雨未停 提交于 2019-12-23 20:25:44
问题 In the Status Report page in drupal, i usually find this message (on fresh installation): Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the PECL uploadprogress library (preferred) or to install APC. But i never understood why its preferred the PECL uploadprogress library over APC, and that's my question today. Is pecl uploadprogress faster, take less system resources, or is more easy to install/configure/use

FTP vs HTTP upload on iPhone

天大地大妈咪最大 提交于 2019-12-23 19:12:25
问题 In my iPhone application I need to upload images to a server. I don't worry much about security and stuffs, just need a fast and reliable method. I can embed my image data on the HTTP post request, or I can create a FTP connection to the server (using the SimpleFTPSample from Apple). The disadvantage of each method is: - HTTP: time out if image too big without way of resuming, and no way to know the upload progress (%)? - FTP: sometimes I got NSStreamEventErrorOccurred and don't know why

Debugging a PHP file called by jQuery

跟風遠走 提交于 2019-12-23 18:35:23
问题 I'm using uploadify (a jQuery uploading) script, which has basically a PHP file at the backend. I want to do some kind of debugging of PHP code, (for example see what kind of errors I get in the PHP file (when it's called by jQuery), but I don't know how I can print the errors. For example the original PHP file is: <?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/'; $targetFile = str_replace('//','/',

Posting Photo to FB results in Requires upload file error

本小妞迷上赌 提交于 2019-12-23 18:08:54
问题 I have the following code which I think is very close to working but I keep getting the following error: {"error":{"message":"(#324) Requires upload file","type":"OAuthException"}} but I cannot figure out how to specify the upload file... I have tried both image and source, both give the same error. Any thoughts, help, suggestions would be greatly appreciated as I have been struggling with this for a couple of days and it seems like it should not be this hard... <html> <head> <title>Photo

How to upload base64 image to aws s3 using putObject?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 17:57:11
问题 I try to send base64 png image file to AWS s3 using putObject. And I wonder that exactly what is payload? payload = hash(base64Image) ? here is a detail. $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); I returned that Message: S3::putObject(): [SignatureDoesNotMatch] The request signature we calculated does not match the signature you provided. Check your key and signing method. Request PUT /Bucketname/filename.png x-amz-content-sha256=hash('sha256'

Default folder and filename for html file upload

僤鯓⒐⒋嵵緔 提交于 2019-12-23 16:31:14
问题 I'm using a jQuery Ajax plugin to upload image files from a local machine to a webserver. The webpage presents a button marked Upload Image File , the user presses the button and selects the file to upload from a popup directory listing presented by the browser, PHP at the server stores the image file away, and all that works fine. When the user views the webpage to upload the image, the file path of the image on the local computer is completely predictable. This is part of a workflow where

Upload base64 image to amazon s3

一个人想着一个人 提交于 2019-12-23 15:44:55
问题 I'm having some issues when trying to upload an image to AWS S3. It seems to upload the file correctly but, whenever I try to download or preview, it can't be opened. Currently, this is the upload code I'm using: <?php require_once 'classes/amazon.php'; require_once 'includes/aws/aws-autoloader.php'; use Aws\S3\S3Client; $putdata = file_get_contents("php://input"); $request = json_decode($putdata); $image_parts = explode(";base64,", $request->image); $image_type_aux = explode("image/", $image