upload

How To Upload Images to Amazon S3 Using Perl?

我的梦境 提交于 2019-12-04 10:14:59
I'm trying to upload files to S3 using Perl. According to this module: http://metacpan.org/pod/Amazon::S3::Bucket ...the following code will upload text files: # create resource with meta data (attributes) my $keyname = 'testing.txt'; my $value = 'T'; $bucket->add_key( $keyname, $value, { content_type => 'text/plain', 'x-amz-meta-colour' => 'orange', } ); However, how do you upload images (GIF, JPEG, PNG) to S3? Thanks, Linda That code won't upload the file - it's simply setting the value associated with the key "testing.txt" to "T". If you want to upload a file you could use the add_key

File Upload Size Validation

心已入冬 提交于 2019-12-04 09:49:08
Validations are a big problem, as if i validate in php it has all the functions etc i need to make it work.. But it uploads the file first on a temporary location and then checks, which sucks. If someone uploads a file of 100mb he has to wait for the time just to get no error, but just some internal php screw up hanging the page. One Way: JS //file is id of input file alert(document.getElementById('file').files[0].fileSize); This works in firefox, safari, chrome i guess too, NOT: In opera, quite sure IE too but IE can be taken care of by ActiveX file size but Opera i am still stuck. So pretty

xhr uploading progress while using expressjs multer

末鹿安然 提交于 2019-12-04 08:44:45
问题 I am trying to use XHR to track uploading progress, but at my onprogress callback at event.total I only getting Content-Length from response header instead of uploading file size: xhr.onprogress = (event) => { console.log('Progress ' + event.loaded + '/' + event.total); } I use Multer to handle file uploading and seems it is not avaible to handle file uploading by default: https://github.com/expressjs/multer/issues/243 So I tried to handle uploading with progress-stream: var p = progress({

How can I upload a document to SharePoint with Perl?

夙愿已清 提交于 2019-12-04 08:17:02
I have a Perl app that runs some perforce operations, in the end I would like it to upload the results to SharePoint website. What is the simplest Perl script that can accomplish a task of adding a document to SharePoint? The script would need to run on Solaris and use as few as possible external libraries as possible (definitely pure classic Perl) getting anything additional installed on these unix boxes is a pain and would have to be done by remote team. If this can uploading document can easily be done with wget, that would be of interest too. Anyways, I am looking for 1 or a couple liner

Laravel 5: How do you copy a local file to Amazon S3?

江枫思渺然 提交于 2019-12-04 08:13:16
I'm writing code in Laravel 5 to periodically backup a MySQL database. My code thus far looks like this: $filename = 'database_backup_'.date('G_a_m_d_y').'.sql'; $destination = storage_path() . '/backups/'; $database = \Config::get('database.connections.mysql.database'); $username = \Config::get('database.connections.mysql.username'); $password = \Config::get('database.connections.mysql.password'); $sql = "mysqldump $database --password=$password --user=$username --single-transaction >$destination" . $filename; $result = exec($sql, $output); // TODO: check $result // Copy database dump to S3

Batch upload requests to Google Cloud Storage using javascript

徘徊边缘 提交于 2019-12-04 07:45:57
I'm trying to upload multiple images to google cloud storage in a batch request using javascript. I'm using https://developers.google.com/storage/docs/json_api/v1/how-tos/batch#example as reference. I have an input file where the user can select multiple files, and an 'upload' btn to upload to GCS like so: <input type="file" name="fileName" id="fileInput" multiple="multiple" onchange="javascript: loadFiles()"/> <input type="button" name="upload-btn" id="upload" value="Upload"/> When the user selects the images, the 'loadFiles' function creates the 'body' of the batch request. var tok = <token>

JS ProgressEvent is only fired when finished

[亡魂溺海] 提交于 2019-12-04 07:41:50
I am having some problems getting my upload progress bar to work properly. According to the XMLHttpRequest Level 2 specs, I attached event listeners for loadstart and progress like this: var xhr = $.ajaxSettings.xhr(); xhr.upload.addEventListener('loadstart', function(e) {progressCallback(0);}); xhr.upload.addEventListener('progress', function (e) { progressCallback(e.loaded / e.total); }); $.ajax({ url: url, type: 'POST', processData: false, contentType: false, data: formData, xhr: function () { return xhr; } }).done(function (data) { // Finish stuff }) The file is correctly uploaded but the

cURL upload to Google Drive

人盡茶涼 提交于 2019-12-04 07:41:21
I can create a file in Google Drive through a json into a Drive folder: $data = array( "title" => $_FILES['file']['name'], "parents" => array(array( "kind" => "drive#parentReference", "id" => $parent_id )), "mimeType" => "application/pdf" ); $data = json_encode($data); $url = "https://www.googleapis.com/drive/v2/files?oauth_token=".$accessToken; $ch = curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch

PHP uploading script - create folder automatically [duplicate]

孤街浪徒 提交于 2019-12-04 07:12:54
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Check if directory exists (PHP) Post deleted - Post deleted - Post deleted - Post deleted 回答1: Use file_exists function to check if the folder or tree exists, then use PHP mkdir function. 回答2: The is_dir function checks if a folder exists and mkdir will create the folder if you need to. 回答3: Check if there is a directory. If not, create one. Where is the problem? 来源: https://stackoverflow.com/questions/11454053

PHP check for errors in input, if no errors execute and upload

爷,独闯天下 提交于 2019-12-04 07:11:10
问题 I'm currently working on a registration system and ran into some problem. I'll start with pasting a simplified version of the code before: session_start(); if (isset($_SESSION['logged_in'])) { header('Location: #notLoggedIn'); exit; } else { if ($_SERVER["REQUEST_METHOD"] == "POST") { if //if field is empty { //display error } else if //check if any unallowed characters { //display another error } else { //give the checked input a string/variable, ex: $name= ($_POST["name"]); } // Like 4-5