I am using the below upload class for image upload and manipulating.
class.upload.php samples, a files uploading and images manipulation PHP class
Now I want to change form input type="file" to a text field where I will give a Image URL.
How can I make this uploading class to work.
Thanks In Advance.
this class seems to accept url's as arguments as well so just change the input type to text, name to for example image_url and use this line to manipulate the image as you wish after submitting the form:
$handle = new upload($_POST['image_url']);
Get the file name through text box and in background use php curl function to upload the file in the server and your uploading class will work fine
PHP Curl to upload file
Related
I'm developing a custom Joomla component for creating, editing and saving data of single records including images. I know that in admin/models/forms/record.xml there must be field name="image" type="file" accept="image/*" but how and where do I need to write the simple php-code for uploading images to specific folder, in which file and how?
if we use field type 'media' in record.xml there is no need to
write upload code.
if we use field type 'file' then we can write upload code in model (models/record.php) . we will put upload code in save function after overriding it.
save function will look like
public function save($data)
{
//file upload code.
return parent::save($data);
}
I am using a scanner API to scan images in my web application, its running well. But its create an image to view with src coded likes this:
<img src="data:image/jpeg;base64,/9j/4AAQS....">
I want to upload this image using my simple code witch post (input file) to PHP file in ajax by element id
<input type="file" >
So how can I convert this img element to (input file) element, or how can I post and upload this coded src
Thanx
I added an image to PDF using $p->load_image (http://www.php.net/manual/en/function.pdf-fit-image.php). Now, I want to write JavaScript in it so that the user can manipulate image in the PDF. How can I get access to the image in PDF using Javascript?
Using PdfLib, add the following option to the load_image call:
"iconname=HelloImage" where HelloImage is the name of the image. The complete call would be,
$p->load_image('jpeg', 'C:/hello.jpg', "iconname=HelloImage");
In Javascript code, you can access it. For example,
var hello_image = this.getIcon("HelloImage");
Now hello_image points to the HelloImage.
I have an image (a captcha specifically) that I want to upload to my server using PHP (or if possible and better, only JQUERY)
I created an object with this code:
var newIMG = $("img[name='captchaImage']").clone();
But I cannot send it via jQuery's ajax method or else. (Even tried to manually add but no idea how to send an object as file)
What should be the simplest PHP / jQuery code to send this object?
Thanks in advance,
You can use jsupload plugin for this purpose.
One cannot upload files using AJAX..
You can also use an iframe to simulate uploading the files..
only jquery file upload is not possible you need php
and you can use the jQuery File Upload to upload file via ajax and jquery
i need to upload a file doc or pdf or rich text through jquery and smarty
i try to pass the file in jquery is given below
window.location.href= sitePath+'download?p='+$('#file').val();
but the p doesn't have value. how to get the file path or name and how can stored in server
in controller i write just pass the query to model is given below
$model=new download();
$id=$model->upload($param);
and i can't develop the model code....
please help me
You can't send files like that.
You should either submit a form with enctype="multipart/form-data" or use some AJAX uploader (which uses form submit to iframe and then stores a file using PHP script).
EDIT: Some references
http://www.w3schools.com/php/php_file_upload.asp - tutorial on how to upload a file using PHP
http://valums.com/ajax-upload/ - example of ajax uploader.
EDIT2: The problem is not with your model code but with the way you try to submit a file.