On the page checkout have tags:
<input type="file" name="upload_file_name"><input name="MAX_FILE_SIZE" value="1048576" type="hidden">
Using hook place_order after click on confirm order button for upload file, but in function
fn_my_changes_place_order($order_id, $action, $order_status, $cart, $auth)
cant get $_FILES data.
Please help me! How to upload file?
Thanks.
Related
I have the Attached DOM structure as well [Flow is Click select banner button->(inside frame click upload button)-->upon clicking upload button -->Select files button has to be used for upload]
I have used below steps and methods
upload function is happening inside the iframe
Looking forward to your suggestions
const mFrame=page.frameLocator('iframe[name="entity_browser_iframe_eb_banner_slides"]').locator('html');
await mFrame.locator("//a[contains(text(),'Upload')]").click(); //clicking upload button
await mFrame.setInputFiles('//*[#id="edit-upload"]/div',filepath); //uploading image
upon running above code I am getting below error
frame.setInputFiles: Error: Node is not an HTMLInputElement
You don't actually have to click anything for this to work.
Assume I have HTML like this:
<div>
<input name="files" id="files" type="file" size="80" />
<input id="submit" value="Upload Document" />
</div>
I can simply perform the following to set the file for upload upon form submission:
const btnUpload = page.locator('#files');
const btnSubmit = page.locator('#submit');
await btnUpload.setInputFiles(fileName);
await btnSubmit.click();
That should help you but if it does not work when tweaked to be used in your iframe, please post your html.
EDIT: Without seeing your html, you can probably get away with just this:
const frame = page.frameLocator('iframe[name="entity_browser_iframe_eb_banner_slides"]');
await frame.setInputFiles('#edit-upload', filepath);
How can I send the lastInsertId again to another php document?
Explanation why:
After someone sends a form (form.html) to a database (send.php) he will get an ID for that form. This ID I show in the send.php to the person via PDO:
<p>Your ID:<?php echo $dbh->lastInsertId(); ?></p>
At this confirmation page I want give the person the possibility to print the data from his form as an pdf. So I wrote:
<form action="print.php" method="POST">
<input type="hidden" name="ID" value="<=htmlspecialchars($_POST['lastInsertId']);?>"/>
<input type="submit" name="Print" value="Print" >
</form>
But I he doesn't send the lastInsertId -> I guess the problem is here:
value="<?=htmlspecialchars($_POST['lastInsertId']);?>"
Can you help me to solve that problem?
Your code should be like this:
<form action="print.php" method="POST">
<input type="hidden" name="ID" value="<?php echo $dbh->lastInsertId(); ?>"/>
<input type="submit" name="Print" value="Print" >
</form>
Not sure if it's the best way, but I once needed the last ID of a person who registered.
I did the following after inserting the info into the DB (My table has Auto Increment Primairy Key ID):
$lastId = mysqli_insert_id($con);
You can store the ID anywhere you want. (In the URL or cookie)
Hope this helps (:
Thank you very much! That helped.
Is their an easy way that after he press print (now gets with the ID all the data from the database to show it at the site print.php - that part all works) and NOW DIRECTLY asks to save as pdf?
Using MODX Revolution and Formit, I try to attach a file to a contact form. The mail is sent but without the attachment. For some strange reason, I can also no longer find any information on the attachments hook. Has that feature been removed from Formit recently?
[[!FormIt?
&hooks=`spam,email,attachments,redirect`
&emailTpl=`sometemplate`
&emailTo=`foo#foo.com`
&emailBCC=`foo2#foo.com`
&emailSubject=`some subject`
&redirectTo=`123`
&validate=`name:required, filedata:required`
]]
<form action="[[~[[*id]]]]" method="post" class="form" enctype="multipart/form-data">
<input type="text" name="name" id="name" value="[[!+fi.name]]">
<input id="filedata" name="filedata" type="file" value="[[+fi.filedata]]">
<button type="submit">SEND</button>
</form>
Again, mail is sent (I tried many different email adresses) but the attachment is always missing. What's wrong?
Did you try https://modx.com/extras/package/ajaxupload2 extra?
From description:
With two FormIt hooks the upload queue could be pre filled from a FormIt field
value and be saved into a FormIt field value. With a third FormIt hook the
uploaded files could be attached to the FormIt mails.
Just leave the hook 'attachements' away, formit handles a file input without that hook.
I've read the answers to the question asked here :
How to upload file to remote FTP Server in grails
everything compiles and runs without errors. Now how do I reference the upload service from a Grails form? Sorry for the basic question.
So far I'm playing around with
<g:form action="do_something" enctype="multipart/form-data" useToken="true">
<span class="button">
<input type="file" name="thefile"/>
<input type="submit" class="upload" value="upload"/>
</span>
</g:form>
but I just need a few pointers as to how to link this with the service, presumably via the controller.
Work with the request. Get the file name and create a new file. my own code:
def f = request.getFile('myfile');
def webrootDir = servletContext.getRealPath("/"); //app directory
File fileDest = new File(webrootDir,"xmls/");
def xmlFile = new File(fileDest, "settings.xml");
f.transferTo(xmlFile);
Just look at this post for more info.
The file upload component from a 3rd party vendor does not work with my MVC 6 project. Therefore I built a very simple upload mechanism with standard asp.net components:
<form method="post" asp-action="Index2" asp-controller="Data" enctype="multipart/form-data">
<input type="file" name="files" multiple />
<input type="submit" value="Upload" />
</form>
This upload works fine. I receive the uploaded file in my POST-Method in the controller. However if I start the full featured upload component (dxFileUploader from DevExpress) I don't receive the file. My method in the controller will be called but the file collection is empty. In order to compare the two upload requests I created a Fiddler for both. The requests are very similar. Has someone an idea what's the problematic difference between the two requests?
#Marco, I know this is old, however, ensure that the binding in your controller is correct, meaning the parameter to your action matches the name of the component. I am using the dxFileUploader (version 16.1) with the following action:
public async Task<IActionResult> UploadProducts([FromForm]IFormFileCollection files){...}
And the following in my view :
$("#file-uploader").dxFileUploader({
selectButtonText: "Select Product File",
labelText: "",
accept: "text/csv",
uploadMode: "useForm",
name: "files"
});
I hope this helps.