开发者

Dynamin upload path with AJAX file uploader

Im using http://valums.com/ajax-upload/ on my site. I would like to know if theres a way to get the upload path from a textbox or similar.

Index.php:

<script>
   function createUploader(){
       var uploader = new qq.FileUploader({
           //  pass the dom node (ex. $(selector)[0] for jQuery users)
           element: document.getElementById('file-uploader'),
          // path to server-side upload script. In our case server/php.php
          action: 'server/php.ph开发者_C百科p'
       });
   }
   window.onload = createUploader;

php.php:

...
$result = $uploader->handleUpload('../../uploads/');
...

Any help is much appreciated. Thanks


Easily, like this:

jQuery:

var uploadLoc = "/my/upload/path";
uploader.setParams({ action: "server/php.php?p="+uploadLoc });

PHP:

...
$result = $uploader->handleUpload($_GET["p"]);
...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜