upload

php how to use getimagesize() to check image type on upload [duplicate]

三世轮回 提交于 2019-12-04 12:58:25
Possible Duplicate: GetImageSize() not returning FALSE when it should i currently have a filter system as follows: // Check to see if the type of file uploaded is a valid image type function is_valid_type($file) { // This is an array that holds all the valid image MIME types $valid_types = array("image/jpg", "image/JPG", "image/jpeg", "image/bmp", "image/gif", "image/png"); if (in_array($file['type'], $valid_types)) return 1; return 0; } but i have been told that it is better to check the filetype myself, how would i use the getimagesize() to check the filetype in a similar way? getimagesize()

Laravel 5, attempting multi-file upload, Request::file() only returning last file?

≡放荡痞女 提交于 2019-12-04 12:53:23
I'm attempting to get multiple files uploaded using the same key using Laravel 5's Request facade. From what I've read elsewhere, the correct way to do this is to call Request::file() without passing a parameter to the ::file() method. However, this only seems to return the last file sent in the request. Headers POST /test/service/upload HTTP/1.1 Host: www.****.dev X-CSRF-TOKEN: 2DQBuTuy50EELFen5vXFaOv1cyXICmAISUx8LoCS Cache-Control: no-cache ----WebKitFormBoundaryE19zNvXGzXaLvS5C Content-Disposition: form-data; name="photo"; filename="10464005_10152969193248906_6272325120604924631_n.jpg"

CodeIgniter Uploading Large Files

不羁岁月 提交于 2019-12-04 12:31:12
问题 I have set up codeigniter to upload small files < 2MB and that works fine. But I am having trouble uploading large files 20MB > function stage1() { ini_set('upload_max_filesize', '200M'); ini_set('post_max_size', '200M'); ini_set('max_input_time', 3000); ini_set('max_execution_time', 3000); $config['upload_path'] = './temp/'; $config['allowed_types'] = 'zip'; $this->load->library('upload', $config); $this->upload->initialize($config); if(!$this->upload->do_upload('userfile')) { $error = array

Upload, resize, and crop center of image with PHP

感情迁移 提交于 2019-12-04 12:04:22
I'm wanting to create a very very basic upload, resize, and crop PHP script. The functionality to this will be identical (last i checked anyway) to the method Twitter uses to upload avatar pictures. I want the script to take any size image, resize the shortest side to 116px, then crop off the top and bottom (or left and right side if it's landscape) as to get a square 116px by 116px. I don't want a bloated PHP script with client side resizing or anything, just a simple PHP resize and crop. How is this done? The GD Library is a good place to start. http://www.php.net/manual/en/book.image.php

Can't upload images on Heroku server

蹲街弑〆低调 提交于 2019-12-04 11:56:34
Got some problem with uploading images to heroku server, on localhost everything work great. But on heroku when I upload image, it looks that all goes well but after refreshing the page I got a error message 404 (Not Found) so it seems that it doesn't uploaded. Here is my code var express = require('express'), app = express(), server = app.listen(process.env.PORT || 5000), fs = require('fs-extra'), im = require('imagemagick'), util = require('util'), formidable = require('formidable'); app.post('/upload', function (req, res){ var form = new formidable.IncomingForm(); // show respond form.parse

Brief code example to upload image from iPhone to ImageShack account

淺唱寂寞╮ 提交于 2019-12-04 11:51:37
I'm trying to upload a jpg image from my iPhone to my ImageShack.com account. Everyone says to use the MASSIVE THOUSANDS of lines of code in the 3rd party ASI code. Is there a simple example, just of the upload code? (I'll take either sync or async) Shouldn't this be doable with under 25 lines of code? Thanks. 来源: https://stackoverflow.com/questions/4167958/brief-code-example-to-upload-image-from-iphone-to-imageshack-account

Django upload failing on request data read error

我与影子孤独终老i 提交于 2019-12-04 11:44:07
I've got a Django app that accepts uploads from jQuery uploadify , a jQ plugin that uses flash to upload files and give a progress bar. Files under about 150k work, but bigger files always fail and almost always at around 192k (that's 3 chunks) completed, sometimes at around 160k. The Exception I get is below. exceptions.IOError request data read error File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 171, in _get_post self._load_post_and_files() File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 137, in _load_post_and_files self._post, self.

Python app engine: how to save a image?

别等时光非礼了梦想. 提交于 2019-12-04 11:30:14
This is what I got from flex 4 file reference upload: self.request = Request: POST /UPLOAD Accept: text/* Cache-Control: no-cache Connection: Keep-Alive Content-Length: 51386 Content-Type: multipart/form-data; boundary=----------ei4cH2gL6ae0ei4ae0gL6GI3KM7ei4 Host: localhost:8080 User-Agent: Shockwave Flash ------------ei4cH2gL6ae0ei4ae0gL6GI3KM7ei4 Content-Disposition: form-data; name="Filename" 36823_117825034935819_100001249682611_118718_676534_n.jpg ------------ei4cH2gL6ae0ei4ae0gL6GI3KM7ei4 Content-Disposition: form-data; name="Filedata"; filename="36823_117825034935819_100001249682611

How do I set the uploaded files folder for SWFUpload?

纵饮孤独 提交于 2019-12-04 10:55:23
I don't see in the documentation how to set the uploaded files folder with SWFUpload. Can anyone point me to the right direction? I'm using PHP 5 if it helps. Ólafur Waage What you do is call a PHP script, and that script handles the file uploading. You can turn on debug, this will give you a pretty nice debug view of what is happening, and the output of the PHP file in question. The flash doesn't handle the uploading because the flash is actually running on the client machine. Here's an example of the config I use. flash_url : "js/swfupload/flash/swfupload.swf", upload_url: "ajax/flash_upload

How to trigger Uploadify onError event handler?

折月煮酒 提交于 2019-12-04 10:15:12
I am using Uploadify to upload files. Problem is, I need to inform users of any error during processing of those files. Uploadify has onError , onComplete , and onAllComplete event handler but I do not know how to trigger these events so that users are informed of what is going on. Do I need to send JSON string? There is a clue here and here and here but I couldn't make it to work. Perhaps the posting in the forum is outdated. Anyone got any example that works for Uploadify 2.1? Brant Messenger This was killing me but I found a way. In the uploadify.php file I created all my validation. The