upload

Laravel Call to a member function getClientOriginalExtension() on null

旧城冷巷雨未停 提交于 2019-12-06 02:17:31
Hello im getting the following error while upload an image using laravel: "Call to a member function getClientOriginalExtension() on null". Here is my controller: $imageName = rand(11111, 99999) . '.' . $request->file('image')->getClientOriginalExtension(); $destinationPath = 'events'; $fileName = rand(11111, 99999) . '.' . $extension; $upload_success = $image->move($destinationPath, $imageName); Here is my view: {!! Form::file('image', null, ['class' => 'form-control']) !!} How do i save the $imageName to the pic field in my database. I tried this but it doesn't work. The field remains empty

Unable to upload files with Flask on Heroku

隐身守侯 提交于 2019-12-06 01:55:28
I'm attempting to add a file addition button that uploads a file to a folder on my Flask Heroku app but I get an application error when I hit the submit button. class PhotoForm(Form): photo = FileField('Your photo') submit = SubmitField('Submit') @app.route('/upload', methods=('GET', 'POST')) def upload(): form = PhotoForm() if form.validate_on_submit(): filename = secure_filename(form.photo.data.filename) form.photo.data.save("uploads/" + filename) else: filename = None return render_template('upload.html', form=form, filename=filename) Here is the upload.html: {% extends "base.html" %} {%

How to upload image path and name to database - Codeigniter

ぃ、小莉子 提交于 2019-12-06 01:27:20
I know that this question has been asked several times, but all the other question I found are different from what I want. I want to upload the filename and filepath to a table called 'factoryimages'. What's the best way of doing this? My controller function: function do_upload() { $config['upload_path'] = './assets/uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '1000'; $config['max_width'] = ''; $config['max_height'] = ''; $config['overwrite'] = TRUE; $config['remove_spaces'] = TRUE; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) {

Android上使用camera拍照,把获取的照片上传到远程服务器

被刻印的时光 ゝ 提交于 2019-12-06 00:56:27
参考原文: Take a Photo from Android Camera and Upload it to a Remote PHP Server 使用Java上传文件 从 Apache Software Foundation 下载 HttpClient 4.3.4。 在工程中添加下面的jar包: 参考sample,写一个简单的上传: public static void main(String[] args) throws Exception { // TODO Auto-generated method stub CloseableHttpClient httpclient = HttpClients.createDefault(); try { HttpPost httppost = new HttpPost("http://localhost:8003/savetofile.php"); // your server FileBody bin = new FileBody(new File("my.jpg")); // image for uploading HttpEntity reqEntity = MultipartEntityBuilder.create() .addPart("myFile", bin) .build(); httppost.setEntity

Should I generate each thumbnail dynamically every time it is requested, or store them on image upload? [duplicate]

混江龙づ霸主 提交于 2019-12-06 00:50:26
问题 This question already has answers here : PHP image resize on the fly vs storing resized images (4 answers) Closed 6 years ago . Problem - I wanted to set up an image-uploading feature in my website. But I wanted to show both- the original image and a small thumbnail of the image. Choices - Which way is better - to create a separate image (thumbnail) in a directory when the image is uploaded or to show a smaller version by reducing its height and width in the fixed ratio every time the image

C# HttpWebRequest form upload

萝らか妹 提交于 2019-12-06 00:48:09
im trying to automate a file upload from my C# program. This is the method to upload a file. public static string UploadFileEx(string uploadfile, string url, string fileFormName, string contenttype, NameValueCollection querystring, CookieContainer cookies) { if ((fileFormName == null) || (fileFormName.Length == 0)) { fileFormName = "file"; } if ((contenttype == null) || (contenttype.Length == 0)) { contenttype = "application/octet-stream"; } string postdata; postdata = ""; if (querystring != null) { foreach (string key in querystring.Keys) { postdata += key + "=" + querystring.Get(key) + "&";

Resize image with PHP, detect longest side, and resize according?

十年热恋 提交于 2019-12-06 00:37:29
I'm working on an image upload script with PHP, I found one someone was offering and tried modifying it, however, i'm running into a few problems. I want to do the following: Detect the longest side of the image (ie. portrait or landscape) And then resize the image, with the longest side being 800px AND keep proportions. Here is the code I have so far.. For landscape images it works fine, but with portrait ones it distorts them like crazy. PS. I'm making a larger image as well as a thumbnail. list($width,$height)=getimagesize($uploadedfile); if($width > $height){ $newwidth=800; $newheight=(

Upload images to remote servers. PHP

血红的双手。 提交于 2019-12-05 23:18:23
I do the image hosting and I have a problem.. I have 3 servers. First - Site/script Any two servers for images. How I Can upload image from "one" server (script) to second and third servers? <?php if (isset($_POST['upload'])) { $blacklist = array('.php', '.phtml', '.php3', '.php4', '.php5'); foreach ($blacklist as $item) { if(preg_match('#' . $item . '\$#i', $_FILES['file']['name'])) { echo "We do not allow uploading PHP files\n"; exit; } } $uploadDir = PROJECT_ROOT . 'upload/'; // 1ST SERVER (THIS SERVER) $uploadFile = $uploadDir . basename($_FILES['file']['name']); if (move_uploaded_file($

Google developer screenshot (graphic assets) error image not valid

≯℡__Kan透↙ 提交于 2019-12-05 23:05:53
Trying to upload any graphics such as screenshot, icon, Feature graphic and I keep having the same error from from Google while my picture have the right spec. message is "Upload Error" "You need to check that your screenshot image is valid valid" or "You need to fix your feature graphic is valid" Anyone has the same error or any clue? I've even used another graphic from another app published and it still dont want it anymore. I've also deleted my app and create a new one in the Dev account. Same issue. I'm desperate. I have the same error. Try with another browser. Firefox works for me.

jQuery AjaxUpload, have to click button twice?

人走茶凉 提交于 2019-12-05 22:55:43
I am using the AjaxUpload plugin with jQuery, and everything is working fine for the most part, but I have to click my button twice to get it to execute. I'm guessing this is a scope issue... or(?) still learning... Here is my code: $(".upload-button").live("click", function(event) { event.preventDefault(); var currentId = $(this).closest("div").attr("id").replace("slide-", ""); new AjaxUpload($(this), { action: "./php/upload.php", name: 'userfile', autoSubmit: true, onSubmit: function(file , ext) { }, onComplete: function(file, response) { // enable upload button // this.enable(); $("#slide-"