nghi Posted November 15, 2016 Share Posted November 15, 2016 I'm currently making a module that upload/save a csv... Am I missing something? I'm having some difficulties getting this to work. $this->setFuel('processHeadline', "Import Programs"); $form = $this->modules->get("InputfieldForm"); $form->method = 'post'; $form->action = '../save/'; $field = $this->modules->get("InputfieldFile"); $field->name = 'file'; $field->label = 'Upload Program CSV'; $field->extensions = 'jpg png csv'; $field->maxFiles = 1; // $field->overwrite = true; // $field->required = true; $field->description = "Convert spreadsheets to CSV (Comma delimited) (*.csv) before uploading"; // $field->maxFileSize = 200000; $field->destinationPath = "./csv/"; // $field->type = 'file'; $form->add($field); $field = $this->modules->get("InputfieldButton"); $field->type = 'submit'; $field->value = 'Upload CSV'; $form->add($field); return $form->render(); I'm mimicking some code snippets from "Import Pages From CSV module" and that doesn't seem to be working either... so it kind of leads me to believe it could be an environment issue or processwire version. I also don't see any JS errors. Though when making fields through the backend/gui it seems to be working fine. What I'm expecting...http://i.imgur.com/mT2xsUo.gifv What I'm actually experiencing...http://i.imgur.com/4PnVPUs.gifv ProcessWire 3.0.39 PHP 7.0 Jason Huck explains the exact problem/situation I'm having. Quote I have a very similar situation. I'm trying to upload a CSV file to a custom admin page, created with the Admin Custom Pages module. I've constructed a simple form using the API. When I load the page, the form appears to render correctly, but it doesn't appear to be working 100% correctly. • Drag and drop isn't working. The browser just offers to open the dragged file. There are no JS errors in the console and it looks as if all the required JS assets are included on the page. If I instead click the "Choose File" button and select a file, it does appear to select a file (if I hover over the "Choose File" button, it displays the selected filename). • Submitting the form does upload the file, though overwrite isn't working. I get the following error when trying to re-upload the same file: "Refused file [my filename] because it is already on the file system and owned by a different field." @source https://processwire.com/talk/topic/12986-file-upload-via-inputfieldfile/#comment-125240 Link to comment Share on other sites More sharing options...
adrian Posted November 15, 2016 Share Posted November 15, 2016 Maybe I am missing something but it looks to me like it's just the AJAX uploader that's not actually working. I think the file has been selected and if you click your "Continue to Step 2" button it will be fine. I think what you are seeing is related to this: https://github.com/processwire/processwire-issues/issues/38 1 Link to comment Share on other sites More sharing options...
nghi Posted November 15, 2016 Author Share Posted November 15, 2016 Ah I see. This is good to know. I got the upload field to 'work' after further debugging the issue. 1 Link to comment Share on other sites More sharing options...
adrian Posted November 15, 2016 Share Posted November 15, 2016 1 minute ago, nghi said: I got the upload field to 'work' after further debugging the issue. Do you have a minute to share what you found so it might help others ? Link to comment Share on other sites More sharing options...
nghi Posted November 15, 2016 Author Share Posted November 15, 2016 Sorry I mis-spoke. The ajax bug is still appearing on pw3.0 but the file seems to be saving properly after submiting/post. I did run into a weird error. Saying the file already exist. and I had to add $csvFile->rename("data.csv"); when processing the form. The module I'm making is for a 2.5 pw. I was just dabbling around in 3.0. I hadn't had any problems in older ver. of pw. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now