Jump to content

Search the Community

Showing results for tags 'fieldtypefile'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 4 results

  1. How does one enable executables to be uploaded to the File field? Just adding the file extension to the accepted extensions does not seem to work. screenshot attached (ignore the label 'video')
  2. Hello. Earlier I was able to implement a simple search on a knowledge sharing project for my company but now I was asked to add some functionality where to any page some files can be attached. It went pretty straight forward to use the FieldTypeFile and show up on the frontend all attached files by names. After completting the task I thougth that I could expand my search results allowing the query to search for a string within the attached file names and/or description. So on my working query: $matches = $pages->find("template!=keywords,title|body|keywords~=$q, limit=10"); I tried adding the files_upload field which I created and assigned some file types. The final query got: $matches = $pages->find("template!=keywords,title|body|keywords|file_upload~=$q, limit=10"); but I got a long error text: Error: Exception: SQLSTATE[HY000]: General error: 1191 Can't find FULLTEXT index matching the column list (in C:\OpenServer\domains\nowknow.pw\wire\core\PageFinder.php line 384) #0 [internal function]: ProcessWire\PageFinder->___find(Object(ProcessWire\Selectors), Array) #1 C:\OpenServer\domains\nowknow.pw\wire\core\Wire.php(374): call_user_func_array(Array, Array) #2 C:\OpenServer\domains\nowknow.pw\wire\core\WireHooks.php(549): ProcessWire\Wire->_callMethod('___find', Array) #3 C:\OpenServer\domains\nowknow.pw\wire\core\Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageFinder), 'find', Array) #4 C:\OpenServer\domains\nowknow.pw\wire\core\PagesLoader.php(216): ProcessWire\Wire->__call('find', Array) #5 C:\OpenServer\domains\nowknow.pw\wire\core\PagesLoader.php(216): ProcessWire\PageFinder->find(Object(ProcessWire\Selectors), Array) #6 C:\OpenServer\domains\nowknow.pw\wire\core\Pages.php(225): ProcessWire\PagesLoader->find('template!=keywo...', Array) #7 [internal function]: ProcessWire\Pages->_ This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. Obviously I am not getting the correct way of searching for a file name or file description in the query. Any ideas how to accomplish that?
  3. Hi, I'm just trying to delete file field via API. I want to delete it completely without concerning which pages is using it. I found this code: $fields = wire('fields'); foreach ($fields->find('name=field_name') as $field) { foreach ($field->getFieldgroups() as $fieldgroup) { $fieldgroup->remove($field); $fieldgroup->save(); } $fields->delete($field); } This removes the field from database it is OK. But it doesn't remove the files (from filesystem) that ware added to pages. As I was going through PW source code I've found that I have to save the page also, but it really complicates the thing. The problem starts in FieldtypeFile::___deletePageField method where the $pagefile is handled differently according to field output formatting. If the $pagefile is PageFile, the unlink is called which also deletes the file from filesystem. If the $pagefile is PageFiles the deleteAll is called which only adds hooks on page save. Why is it done this way? This makes inconsistency when deleting the field. Is there some better way to delete the field without caring about pages?
  4. I'm building a smartphone app that allows users to record a voice clip and send it to our server, which runs ProcessWire. Files are sent over HTTPS Post, currently without any sort of authentication. I've succeeded using the WireUpload class to fetch the uploaded file from the $_FILES super global. Where I get in trouble is when I try to add the audio file to the audio page, where there's an Input field called 'audiofile'. Whenever I try to use any file related method, an Internal Server Error occurs. Here's my code, which runs in the page's template. <?php Header("Content-Type: text/plain"); $upload_path = $config->paths->assets . "files/audio/"; $u = new WireUpload('files'); $u->setMaxFiles(1); $u->setOverwrite(false); $u->setValidExtensions(array('mp3', 'mp4', 'm4a')); $u->setDestinationPath($upload_path); // I can confirm through my FTP client that the file sent through POST actually shows up in the $upload_path location. $fileresult = $u->execute(); // This is the File input field in my template. Doing print_r($audiofield) confirms this is an existing object. $audiofield = $fields->get("audiofile"); // Trying this for the heck of it, but all that results is HTTP 500. $audiofield->deleteAll(); foreach($fileresult as $filename) { // I've seen various examples on what to do now. Here's one that causes a 500 error. $page->'audiofile' = $upload_path . $filename; // This seems the most logical thing to do, but also causes HTTP 500. $audiofield->add($upload_path . $filename); // Unlinking succeeds (given that I comment out the lines that cause the HTTP 500 errors) unlink($upload_path . $filename); } // We never get to this phase. $page->save(); ?> Things of note: Server runs PHP 5.4.4-14+deb7u8 on Debian with Apache/2.2.22. File uploading through the admin on the audio page works without issues, also when uploading multiple files at once or sequentially. I've confirmed the owner of $upload_path to be www-data and its permissions to be 755. What's the final step I'm missing to add the audio file to the input field on my page?
×
×
  • Create New...