当サイトはユーザー体験を改善するためのメンテナンスを実施中に機能が制限される予定です。記事を読んでもあなたの問題が解決せず質問をしたい場合は、Twitter の @FirefoxSupport、Reddit の /r/firefox で、サポートコミュニティが皆さんを助けようと待機しています。

Mozilla サポートの検索

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

詳しく学ぶ

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

Unable to get uploaded file name or path in requestBody in webRequest.UploadData on browser.webRequest.onBeforeRequest event

  • 3 件の返信
  • 1 人がこの問題に困っています
  • 3 回表示
  • 最後の返信者: champ

more options

I upload file in gmail and try to log file name in webRequest.UploadData but its log like "file : <file> . i needed uploaded file path.

This is my code snippet of java script - function logURL(requestDetails) {


    if(requestDetails.requestBody)
    {
       
        if (requestDetails.requestBody.raw)
        {
            for (var e of requestDetails.requestBody.raw)
            {
                if(e.file)
                {
                    console.log("raw file inside: "+ e.file);
                }
          
            }
        }
       if(requestDetails.requestBody.formData)
       {
           var dictionary = requestDetails.requestBody.formData;
           for (var key in dictionary)
           {         
               console.log("form data : key=" + key + ", value=" + dictionary[key]);
               
           }
       }
    }
   

}

browser.webRequest.onBeforeRequest.addListener(

 logURL,
 {urls: ["<all_urls>"]},["requestBody"]

);

I upload file in gmail and try to log file name in webRequest.UploadData but its log like "file : <file> . i needed uploaded file path. This is my code snippet of java script - function logURL(requestDetails) { if(requestDetails.requestBody) { if (requestDetails.requestBody.raw) { for (var e of requestDetails.requestBody.raw) { if(e.file) { console.log("raw file inside: "+ e.file); } } } if(requestDetails.requestBody.formData) { var dictionary = requestDetails.requestBody.formData; for (var key in dictionary) { console.log("form data : key=" + key + ", value=" + dictionary[key]); } } } } browser.webRequest.onBeforeRequest.addListener( logURL, {urls: ["<all_urls>"]},["requestBody"] );

すべての返信 (3)

more options

Not that you won't get an answer on this forum, but your question may be better suited for the Firefox add-on development community on Mozilla Discourse.

more options

You can't get the upload file path, see #c49 #c50 #c70.

  • Bug 143220 - [FIX]Script can get the value of a file control, including the path
more options

In Documentation mention that requestDetails.requestBody.raw[i].file gives name of file to be uploaded but in my case it does not give file name too. Could you suggest me way to getting name of file to be uploaded in browser.webRequest.onBeforeRequest event?