I got a DDBB with some paths from different files that I keep in a table. What I'm trying to do is the following:
You can click a button which gets all that paths and loads all the files to an input file just to send it as attached file via e-mail using a php script.
The thing is, I don't know if it is really necessary to take that step with jquery or is it possible to send it straight away using php?
If I understand correctly, you have file paths in DB, which is Backend, and when you create page view you are getting paths from DB by PHP still Backend, then you will put a hidden field etc. when a person click a button 'Frontend but dummy action' you want to load these files and send to backend again.
Logically;
If Client and Server are not discrete then this wouldn't be a reliable system, because you are not sure files are in the correct path which means will not be renamed, deleted.
If client and server are the same you don't need to make this with a file upload you already know you have the paths when user click the button ex : button submits the form with id/group_id 1, fetch paths by id or group_id and send by email.
But still you want to do something like that, Html5 has an api http://www.w3schools.com/jsref/dom_obj_fileupload.asp for it, beyond that you need to execute an applet to achieve this I think.
Related
I am trying to generate a report based on user input from a form in html. As of right now, everything works. Except when I generate the report, the url of the newly opened tab contains the location and the name of my php file. Obviously, this report won't be accessible once the user closes that tab.
Is there any way I can store this file on my server and specify a path for it(for each user)?
Or just generate a pdf file out of it? I tried using some libraries but they don't fully support bootstrap.
I have built a blog system where each entry has an associated image file. I have created a php upload for this system and can get everything onto the server. When I write each blog post I have a row in my database which stores the filename of the image, so I could, if I knew the filename already, just type it in.
What I want to do is on my blog post form, instead of being able to type the file name, I want a button to click on which opens a window with all my images in it, then I can click on one and have that filename sent back to the form.
I suppose I could use AJAX to do this but it seems over complicated. Does anyone know of a good way to achieve this.
I have a multi-step form in which i have to choose an image in step 3 and have to pass the image directory or path as a session in another input field in step 4 before submitting form.How I can pass the image path to finally keep it in database??Please Help !( PHP & Mysql)
You can't. There is no way to know where on the user's hard drive a file is stored, let alone a way to go and get it from the web browser (imagine if I made a website that went after your windows directory files; even your password files -- there are obvious security reasons why web browsers don't allow this).
What you can do is upload the image, then use info stored in $_FILES to temporarily track where the file is located on the server, and at final submission do whatever you need to do with it.
so I have this form where I add item to my DB.
Fiedls are:
Name, Description, Image.
Problem is with image, I want to send the new values via AJAX using jQuery to my submit file. Reason for this is to not refresh any page. Everything is fine except IMAGE because browsers keep making the path private ex. "C:\fakepath\myImg.png".
Is it possible to somehow send my image path, because it works with default <form method="post...></form>, only problem is that it is refreshing the page, that's why I want to use AJAX.
Sorry, my native language is not English so maybe you didn't understand me clearly :)
I'm after full path to UPLOAD the image in my submit file. I can't upload image without knowing it's full path, can i?
You can use jquery.form plugin to upload forms without reloading the page.
Examples: http://www.malsup.com/jquery/form/#code-samples
The browser keeps making it a "private" path because the browser client has no knowledge of your server structure and it only knows the path where it is stored on the client machine. The upload goes to a temporary location on your server and it is up to you on the server side to move it from the temporary path to the place you want to store the file,
So in that sense, no you can't specify the destination path using AJAX.
In addition, you never want to allow the client to specify a location on your server. Even allowing them to specify the name that the file will be stored as is a potential security risk.
Hi i have a question that is almost like other questions but with a small but very important difference.
How can i restrict file types for user with a popup showed in the browser.
The standard file input of html can limit that with a command but it does not work in all browser so it is not an option.
I do not want to validate the file extension after the user has chosen a file but before that, when he is choosing.
Founded this http://demo.swfupload.org/v220/index.htm, but it uploads the file after the user has chosen it, i do not want to do that, i want to upload it after the user submits the form.
So the problem looks like this that there are some ways of not letting the user send a not valid file but they are not good because, one is that i validate after the user have chosen the file and the other is that i upload the file before the user submits the form.
I just want a simple thing to not letting to "chose" a not valid file, it does not matter if it will be made with java script or flash, just let it work.
maybe you have some ideas on how to do it because i searched the whole internet and did not found any solution.
Uploadify supports that feature and is very customizable. You should have no problems setting it up in a way that it uploads the file when the user submits.
you can put a condition on the action file of php where all the fields get by submit the page.at that time you can put validation for the file type. if the file type is not as you mentioned then redirect the error message and let user to make try again.
Thanks.
<input type="file" accept="text/html,image/jpeg">
Also: Mozilla`s doc
Not sure if that's what you're after, but Flash FileReference.browse() method has a FileFilter structure as an input argument, and there you can limit the types of files that the upload dialogue will show.
flash.net.FileReference