Jump to content

k07n

Members
  • Posts

    111
  • Joined

  • Last visited

Posts posted by k07n

  1. 10 minutes ago, Testic said:

    I would like to redirect its location to the relative path: ./../secured-files-dir 

    So you need "secured-files-dir" directory on the same level as your site root:

    - www
    -- your-site-root
    -- secured-files-dir 

    • Like 2
    • Thanks 1
  2. 31 minutes ago, Testic said:

     ProcessWire: ProcessUser: Secure File: Path '/' does not exist or is not writeable

    U need absolute/relative filepath but not url. Ex: /var/www/secure/ or c:\www\secure or something like ./../secure if U use windows local server and linux production server

    • Like 3
  3. 1 hour ago, Stefanowitsch said:

    So then I say for example:

    
    $mail->attachment('myfile.txt');

    But this does nothing. The file is never send as an attachment. Can somebody help me how this is supposed to work?

    If I need not the filename but an absolute path to the file, where can I get it? It's not included in the form POST data, isn't it?

    wireMail()->attachment() needs an absolute path for every (disk) file it should attach to a message. 

    UPD: oh, i've missed last sentense, U know about absolute path already. You must save image from POST and then Send it, using absolute path.

    UPD2: VEEERYYY bad example. You need to check uploaded file for type, size etc first. But it should work 😃

    <?php
    if($input->post('submit')) {
        $uploaddir = "/upload/";
        $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
    
        if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
          $mail = wireMail();
          $mail->to("some@one.com");
          $mail->from = "me@me.io";
          $mail->subject("FILE");
          $mail->body("TAKE THIS!");
          $mail->attachment($uploadfile);
          $numSent = $mail->send();
    	} else {
          echo "wtf?!";
    	}
    
    }
    ?>
    
    <form enctype="multipart/form-data" action="/" method="POST">
        <input name="userfile" type="file" />
        <input name="submit" type="submit" value="Send" />
    </form>

     

    • Like 1
  4. I have resolved my case with nginx maps, maybe someone finds this usefull.

    Put all redirects to site-redirect.map

    map $request_uri $redirect_uri {
        /index.php?id=1     /page/;
        /index.php?id=53    /another/page/;
        /index.php?id=62    /and/so/on/;
    }

    Nginx looks thru the list, and if it finds $request_uri match line in left column - it set $redirect_uri = value of right side of line ($redirect_uri var can be named as you want).

    Then include site-redirect.map in http section of nginx config.
    Now we must check for $redirect_uri in server section and if it is set - redirect to new URI, just like that:

    include site-redirect.map;
    server {
        # …
        if ( $redirect_uri ) {
            return 301 $redirect_uri;
        }
    }

    If map is big enought you may need to set map_hash_bucket_size to bigger value (in http section).

    Here is some more examples to play with:

    map $request_uri $redirect_uri {
        # ...
        ~/post-(?<id>\d+)\.html            /post/$id/;
        ~*/catalog/(?<page>.+)\.html?$     /goods/$page/;
    }

    (~)o

  5. @Wanze I'm using 

    $storageLocation = realpath(wire('config')->paths->root . $field->get('storageLocation')) . DIRECTORY_SEPARATOR;

    and 

    ./../secure_files/

    in Storage Location prefs.

    And I get "D:\osp\domains\secure_files\" on dev env and "/var/www/sitename/secure_files/" on live.

    • Like 1
  6. Is it possible to use relative paths in storageLocation? I have different environment on local/live servers and it would be nice to have same value.

    Something like this:

    //$storageLocation = rtrim($field->get('storageLocation'), '/') . '/';
    $storageLocation = realpath($field->get('storageLocation')) . DIRECTORY_SEPARATOR;

     

    • Like 1
  7. Hi!

    I am getting an error on export:

    Uncaught Error: Call to a member function getColumns() on null in \site\assets\cache\FileCompiler\site\modules\TableCsvImportExport\ProcessTableCsvExport.module:108
    
    Stack trace:
    #0 \site\assets\cache\FileCompiler\site\modules\TableCsvImportExport\ProcessTableCsvExport.module(62): ProcessTableCsvExport-&gt;exportCsv()
    #1 \wire\core\Wire.php(374): ProcessTableCsvExport-&gt;___execute()
    #2 \wire\core\WireHooks.php(698): ProcessWire\Wire-&gt;_callMethod('___execute', Array)
    #3 \wire\core\Wire.php(402): ProcessWire\WireHooks-&gt;runHooks(Object(ProcessTableCsvExport), 'execute', Array)
    #4 \wire\core\ProcessController.php(244): ProcessWire\Wire-&gt;__call('execute', Array)
    #5 \wire\core\Wire.php(374): ProcessWire\ProcessController-&gt;___execute()
    #6 \wire\core\WireHooks.php(698): ProcessW in <b>\site\assets\cache\FileCompiler\site\modules\TableCsvImportExport\ProcessTableCsvExport.module</b> on line <b>108</b><br />
    
    

    testing on:

    PW 3.0.52 @ php7.1
    PW 3.0.48 @ php5.6.12

    UPD: ProFields Table v0.1.5

  8. 3 hours ago, Mike Rockett said:

    These kinds of redirects become somewhat tricky as requesting index.php is the same as requesting the root of the site. I have worked around this, but it would still be better to do this via an htaccess redirect. Unfortunately, it would be mean two redirects as you are using a mapping collection.

    Just after line 129 of your htaccess file (part 13, regarding "www"), add the following:

    
    RewriteCond %{REQUEST_URI} ^\/index\.php [NC]
    RewriteCond %{QUERY_STRING} ^id=(\d+) [NC]
    RewriteRule ^ /index_php/%1? [R,L]

    This will redirect, for example, /index.php?id=321 to /index_php/321.

    Now, change your jumplink source to /index_php/{id}.

     

    Thanks. I use nginx, but I get the idea.

    • Like 1
  9. Hi!

    I have a jumplink with wildcard:

    source: index.php?id={id}
    destination: {id|oldsiteid}

    I don't know when (after PW3 update, or Jumplinks module update), but this jumplink stopped working,
    site.com/index.id=123 just redirects to site.com now.

    Any ideas why it's happens?

  10. Anyone have tested hannacode in PW3?

    When I use [[image src=pic1.jpg]] in PW2 — Hanna trim quotes and  sends pic1.jpg to src var, but in PW3 it includes "" to string and looks like src=>"pic1.jpg", so in the rendered code I get _quot_pic1.jpg_quot_

    p.s. [[image src=pic1.jpg]] and [[image src=pic1.jpg]] works fine but...

  11. Hi.

    I have moved my site to another VPS and now I get "Error in hnsmtp::send : cannot connect to smtp-server!".

    Differences in VPS: php 5.4 -> 5.6 and http->https. Can it be the issue in my case or I must dig in other place?

    p.s. I can connect to smtp server in console with

    #openssl s_client -crlf -connect smtp.yandex.ru:465

    so it is not a firewall I guess.

×
×
  • Create New...