Jump to content

dowmedia

Members
  • Posts

    16
  • Joined

  • Last visited

dowmedia's Achievements

Jr. Member

Jr. Member (3/6)

7

Reputation

1

Community Answers

  1. Hello Marcel, in my case I had two level of validation,first via html form pattern,Second the above one. try to get error message with $service_upload->error(); Also if it dosent help get file names and extension with core php $file_ext = $_FILES['my-file']['type'] ; and check for right file.
  2. Sorry For delay in response(I have set notify on this topic. Any one let me know how processwire will notify me,on email??). Although I have made new calender now. But I will be very happy if this problem get solved. Icmini.php file is included in every template to show up mini calender.on clicking that calender a full event candler shows up in new page.By default it should automatically login(They call it Single sign on(SSO).) So I am sure every file of luxical plugin in project is accessible by processwire(I have included processwire index.php in plugin to use api's). problem is in some where sessions of luxical and processwire. Any more debugging Idea is much appreciated.
  3. Hello, In my web app I am needed an event calender separate for each registered user of the site. I used Luxicul calender. Every thing is working fine except the auto sign in into calendar when user sign in into site. I have installed the calender in site folder. and then as per there documentation. <?php $session->lcUser = $caluser; ?> //$caluser is the email of user <iframe id="lcmini" src="<?php echo $config->urls->site ;?>/luxcal/lcmini.php"></iframe> I have write this code users.php template(Into template folder ).In above code I have put user->email in to session variable. thats all I got in there documentation.After debugging I found that my session variable is not passing into the page of Iframe. so it is not sign in automatically . Any help is much appreciated. Thanks In advance Syed Furquan
  4. Please provide code.So that we can get the exact idea.
  5. After a few days of research I found this solution for my above problem. Complete code is-- <?php if ( isset($_POST['submit']) ) { $upload_path = $config->paths->templates . "images/"; $pdfs = new WireUpload('upload'); $pdfs->setMaxFiles(8); $pdfs->setOverwrite(false); $pdfs->setDestinationPath($upload_path); $pdfs->setValidExtensions(array('pdf','xps','pptx')); // execute upload and check for errors $pdf_files = $pdfs->execute(); if(!count($pdf_files)) { $pdfs->error("Sorry, but you need to add a photo!"); return false; } $rep_id = array(); $page->setOutputFormatting(false); foreach($pdf_files as $pdf){ $building = $page->test_rep->getNew(); $building->save(); $rep_id[] = $building->id; $page->test_rep->add($building); } $page->save(); $page->setOutputFormatting(true); if(count($rep_id) === count($pdf_files)){ $count = 0; foreach($pdf_files as $pdf){ $page->setOutputFormatting(false); $repeater_id = $rep_id[$count]; $field_rep = $page->test_rep->get("id=$repeater_id"); // test_rep is table and test_rep_field is field of the table $field_rep->of(false); $field_rep->test_rep_field = $upload_path.$pdf; $field_rep->save(); $page->save("test_rep"); $page->setOutputFormatting(true); $count++; } } } ?> <form action="<?php $_SERVER['PHP_SELF'] ;?>" method="post" enctype="multipart/form-data"> <p>Click the "Select Files" button below to upload your photo.</p> <input type="file" name="upload[]" multiple /> <button type="submit" name="submit">Submit</button> </form> I hope this will help someone while uploading files in repeater fields.
  6. Hello Matthew I saw in your code under "HANDLING MULTIPLE FILE-UPLOAD FIELDS IN THE SAME FORM".. I have done this by adding multiple in HTML form. This way there was no need to keep extra fields and run extra executes (Run foreach). Every thing was working fine until I put the file field inside a repeater. Now the new file is replacing older one inside repeater. I am searching for solution but No luck. Any help is much appreciated. here is my code: $p2= pages->get($id); $pdfs = new WireUpload('f_plan'); $pdfs->setMaxFiles(8); $pdfs->setOverwrite(false); $pdfs->setDestinationPath($upload_path); $pdfs->setValidExtensions(array('pdf','xps')); // execute upload and check for errors $pdf_files = $pdfs->execute(); echo count($pdf_files); //count is showing number of files if(!count($pdf_files)) { $pdfs->error("Sorry, but you need to add a file!"); return false; } foreach($pdf_files as $filename) { $p2->of(false); $new_rep = $p2->floor_plan_rep->getNew(); //floor_plan_rep is my repeater with one file field inside named floor_plan. $p2->save(); echo $pathname = $upload_path . $filename; //all the urls are okey $new_rep->floor_plan = $pathname; $p2->save(); $p2->of(true); unlink($pathname); }
  7. Hello All, I am trying to upload multiple PDF files into one repeater field. The exact situation is, if someone submits the form. make newItem in repeater add all the PDFs in newItem. every thing is working without repeaters(files not getting replaced). But in repeater, only last file remains exist.Other PDFs getting replaced from the newItem field of repeater. My code looks like- $p2= pages->get($id); $pdfs = new WireUpload('f_plan'); $pdfs->setMaxFiles(8); $pdfs->setOverwrite(false); $pdfs->setDestinationPath($upload_path); $pdfs->setValidExtensions(array('pdf','xps')); // execute upload and check for errors $pdf_files = $pdfs->execute(); echo count($pdf_files); //count is working if(!count($pdf_files)) { $pdfs->error("Sorry, but you need to add a photo!"); return false; } foreach($pdf_files as $filename) { $p2->of(false); $new_rep = $p2->floor_plan_rep->getNew(); $p2->save(); echo $pathname = $upload_path . $filename; //all the urls are okey $new_rep->floor_plan = $pathname; $p2->save(); $p2->of(true); unlink($pathname); } Also it is making one extra blank repeater field inside repeater.(I know something is wrong and something is missing in my code. ). Please help. Thanks
×
×
  • Create New...