image-uploading

Image upload with ajax and asp.net returns html

半城伤御伤魂 提交于 2019-12-04 16:27:47
I'm trying to build simple image upload to server. Page is basic asp.net page with webforms. HTML Code - Works fine <div> <input type="file" id="myPhoto" /> <input type="button" id="upload" value="Upload" /> </div> In backend my code in dog.aspx is [WebMethod(EnableSession = true)] public static string uploadDoc(HttpPostedFileBase file) { try { string _file = mkStorage.UploadImg(file); return _file; } catch (Exception e) { return e.Message; } } And the problem I have with jQuery ajax call. It only returns full page to console as a html. It wont even call the WebMethod because my brakepoint

Unable to Upload Image to Server ios

天大地大妈咪最大 提交于 2019-12-04 13:45:11
Hello I am trying to upload Image From my IOS device to server. And Here Is my code to upload the Image - (IBAction)btnUpload:(id)sender { if (self.imageViewGallery.image == nil) { UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Wait" message:@"Please Select An Image To Upload." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [ErrorAlert show]; NSLog(@"error"); } else{ NSData *imageData = UIImageJPEGRepresentation(self.imageViewGallery.image, 90); NSString *urlString = @"http://localhost/ColorPicker/api.upload.php"; NSMutableURLRequest *request = [

Image Upload using intent

心已入冬 提交于 2019-12-04 13:20:27
I'm trying to upload an image for my android mobile application. The code is working fine for a image that was uploaded from the Gallery Folder. But If I select any image from "Recent Images", "Documents", "Downloads" the image path was not extracted and couldn't upload the image. Can you please help me how I can solve this issue. Here's my coding for your reference: package com.example.imageupload; public class MainActivity extends Activity { private ImageView image; private Button uploadButton; private Bitmap bitmap; private Button selectImageButton, takeImageButton; String link = uri; //

Django Image upload and resize

你说的曾经没有我的故事 提交于 2019-12-04 12:31:26
I have a standard Django form with an image field. When the image is uploaded, I would like to make sure that the image is no larger than 300px by 300px. Here is my code: def post(request): if request.method == 'POST': instance = Product(posted_by=request.user) form = ProductModelForm(request.POST or None, request.FILES or None) if form.is_valid(): new_product = form.save(commit=False) if 'image' in request.FILES: img = Image.open(form.cleaned_data['image']) img.thumbnail((300, 300), Image.ANTIALIAS) # this doesnt save the contents here... img.save(new_product.image) # ..because this prints

Error: Validation failed: Images imageable must exist , rails-5.0 , paperclip-5

天涯浪子 提交于 2019-12-04 10:32:25
问题 While i was trying to submit the form, following error occured: Validation failed: Images imageable must exist and render the same new.html.erb view. If i comment the file field in new.html.erb . Product is being created successfully. ProductsController: def new @product = Product.new end def create @product = Product.create!(product_params) if @product.save redirect_to products_path, notice: "Product Created Successfully" else render "new" end end def product_params params.require(:product)

processing an image upload form in django: when to use save() vs chunks() vs cleaned_data?

两盒软妹~` 提交于 2019-12-04 10:23:25
I have successfully uploaded an image using the following code: views.py from django.conf.urls.defaults import * from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response from django import template from django.template import RequestContext from mysite.uploadr.forms import UploadFileForm def upload_file(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): form.handle_uploaded_file(request.FILES['file']) return HttpResponse(template.Template(''' <html><head><title>Uploaded</title></head>

Is it possible to upload image to the server using Bootstrap's Modal dialog box, jQuery, AJAX and PHP? If yes how? If no what's the reason for it?

喜欢而已 提交于 2019-12-04 08:21:47
问题 I'm using PHP, jQuery(jquery-1.9.1.min.js and jquery-ui-1.10.0.custom.min.js), AJAX, Bootstrap design framework(Bootstrap v3.0.0), etc. I'm relatively a newbie in the field of Web Programming. Now at one place I want to show Bootstrap framework's inbuilt modal dialog box on click of a button. In this modal dialog box there will be a HTML File control for uploading the image file. User will select any image file from his/her local machine by browsing the files. Then after performing all the

Sending Pictures like WhatsApp

荒凉一梦 提交于 2019-12-04 07:46:30
I have made a chatting application. I want to add photo/file sharing concept in my application same as WhatsApp. I have made the app using Xmpp/Openfire and current now I am using this function for photo sharing, but it is not all reliable : public void sendFile(final String path, final String receiver) { Thread thread = new Thread() { public void run() { ServiceDiscoveryManager sdm = ServiceDiscoveryManager .getInstanceFor(connection); if (sdm == null) sdm = new ServiceDiscoveryManager(connection); sdm.addFeature("http://jabber.org/protocol/disco#info"); sdm.addFeature("jabber:iq:privacy"); /

java.io.FileNotFoundException in android

回眸只為那壹抹淺笑 提交于 2019-12-04 05:46:05
I'm selecting a image from gallery using code public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallery); Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, SELECT_PICTURE); } public void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { Bitmap bitmap = null; switch (requestCode) { case SELECT_PICTURE: if (resultCode == RESULT_OK) { Uri selectedImage = imageReturnedIntent.getData(); try { bitmap = decodeUri(selectedImage); }

Strict Standards Error while image upload with PHP script

萝らか妹 提交于 2019-12-04 05:40:27
问题 I try to write an image uploader with php. But it is giving an error when I try. Error is: Strict Standards: Only variables should be passed by reference in C:\xx\xx\xx\profile_image_upload_script.php on line 10 Line 10 is: $extension = end(explode(".", $file_name_encrypted)); image upload script <?php $allowedExts = array("gif", "jpeg", "jpg", "png"); $file_name = $_FILES["file"]["name"]; echo "File name:".$file_name; $file_name_encrypted = $file_name."".md5(rand(1, 1000000)); $extension =