Okay
  Public Ticket #1019350
Finding file via URL instead of path
Closed

Comments

  •  2
    MBARI-WP started the conversation

    We have a problem with the wpDataTables plugin. Content in our /wp-content/uploads/ directory gets offloaded to an Amazon S3 bucket after approximately 10 days. To avoid a 404 error for uploaded files in web browsers, nginx provides a redirect for any files that it sees as "404", and rewrites them to be served from Amazon S3. This is a service designed to provide us unlimited paid disk space, by our provider at http://www.wpengine.com.

    If we generate a table or chart from an uploaded excel spreadsheet, say /wp-content/uploads/x/xxxx/xx/excel.xls - the table or chart will work until the file gets uploaded to Amazon S3.

    The error that will show up in wpDataTables indicates file not found: (/nas/content/live/mbari/wp-content/uploads/x/xxxx/xx/excel.xls). This indicates the file is being looked for locally on the server and not via URL. Since the file has moved, and an nginx redirect is not used at the local level, a 404 is encountered.

    Possible Solutions and Feature Requests
    1) Allow us to customize where the target of "Upload" is via wpdatatables - eg: a directory outside of /wp-content/uploads/ so that the file will not get uploaded to Amazon S3.
    2) Refer to the file via URL (http://www.mbari.org/wp-content/uploads/x/xxxx/xx/file.xls) instead of local path (/nas/content/live/mbari/). This will still serve the data due to the nginx redirect reading the file from S3.

    Unfortunately we cannot cherry-pick which files get uploaded to Amazon S3, it has to be offloaded at the directory level - (/wp-content/uploads/). So we must issue these feature requests to the plugin developer.

    Thank you,

    Nancy

  •  1,688
    Miloš replied

    Hi Nancy,
    Thank you for your purchase.

    The library used in the plugin for working with Excel and CSV files (PHPOffice/PHPExcel) unfortunately does not allow to work with files that aren't located on the same host with the WordPress installation, that's why when the files are offloaded the tables do not work any more.

    A workaround/solution in your case would be to use not the built-in WP uploader, but upload manually via FTP to some folder within the same host with you WP (it's important that PHP would have permissions to access this directory for reading), and in the "Input file or URL" field do not use the "Browse" button, but directly paste the PATH of the file (not URL!) of the file (e.g. /var/www/pathtouploads/excel/excel.xls )

    Hope this helps!

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    MBARI-WP replied

    Hello Bogdan,

    This is a good workaround. We created a new directory and pasted the path into wpDataTables and now it works as it should. Thank you so much!

    Nancy

  •  1,688
    Miloš replied

    Hi Nancy,

    We are glad to help.
    If you like our plugin and support please rate our plugin at CodeCanyon on this link. It means a lot to us. Thanks.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables