downlaoding a file in flex.

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

downlaoding a file in flex.

FlexCoders mailing list
Hello, am trying to download a document using flex by calling it from a dynamic source but its not working. here is a sample of the download code i have. Maybe is the Url string am getting wrong. The documents are stored in the documents folder.

private var fileRef:FileReference;
            private var progress_win:progress_popup;
           
            private function openHandler(event:Event):void
            {
                progress_win.uploadProgress.label="downloading %3%% of image file.";
            }

            private function progressHandler(event:ProgressEvent):void
            {
                progress_win.uploadProgress.setProgress(event.bytesLoaded, event.bytesTotal);
            }

            private function fileRef_complete(event:Event):void
            {
                //message.text+=" (complete)";
                removeMe();
            }

            private function removeMe():void
            {
                PopUpManager.removePopUp(progress_win);
            }

            public function startDownload():void
            {

                var url:String="documents/{docs.selectedItem.documentName}";

                var fileRef:FileReference=new FileReference;
                var urlRequest:URLRequest=new URLRequest(url);
                navigateToURL(urlRequest, "_new");

                fileRef.download(urlRequest);

            }
 

Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list
Any help guys?
Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list
What do do you mean by "not working"?
 

     On Thursday, November 6, 2014 4:20 AM, "[hidden email] [flexcoders]" <[hidden email]> wrote:
   

 <!--#yiv9808785342 #yiv9808785342 .yiv9808785342ygrp-photo-title{clear:both;font-size:smaller;height:15px;overflow:hidden;text-align:center;width:75px;}#yiv9808785342 div.yiv9808785342ygrp-photo{background-position:center;background-repeat:no-repeat;background-color:white;border:1px solid black;height:62px;width:62px;}#yiv9808785342 div.yiv9808785342photo-title a, #yiv9808785342 div.yiv9808785342photo-title a:active, #yiv9808785342 div.yiv9808785342photo-title a:hover, #yiv9808785342 div.yiv9808785342photo-title a:visited {text-decoration:none;}#yiv9808785342 div.yiv9808785342attach-table div.yiv9808785342attach-row {clear:both;}#yiv9808785342 div.yiv9808785342attach-table div.yiv9808785342attach-row div {float:left;}#yiv9808785342 p {clear:both;padding:15px 0 3px 0;overflow:hidden;}#yiv9808785342 div.yiv9808785342ygrp-file {width:30px;}#yiv9808785342 div.yiv9808785342attach-table div.yiv9808785342attach-row div div a {text-decoration:none;}#yiv9808785342 div.yiv9808785342attach-table div.yiv9808785342attach-row div div span {font-weight:normal;}#yiv9808785342 div.yiv9808785342ygrp-file-title {font-weight:bold;}#yiv9808785342 --> <!--#yiv9808785342 #yiv9808785342ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv9808785342 #yiv9808785342ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv9808785342 #yiv9808785342ygrp-mkp #yiv9808785342hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv9808785342 #yiv9808785342ygrp-mkp #yiv9808785342ads {margin-bottom:10px;}#yiv9808785342 #yiv9808785342ygrp-mkp .yiv9808785342ad {padding:0 0;}#yiv9808785342 #yiv9808785342ygrp-mkp .yiv9808785342ad p {margin:0;}#yiv9808785342 #yiv9808785342ygrp-mkp .yiv9808785342ad a {color:#0000ff;text-decoration:none;}-->

Any help guys?



   
Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list
In reply to this post by FlexCoders mailing list
when i click the download button, i get an error, concerning the path.
Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list
And what does the error message say exactly?  You need to be more
descriptive in order to help you.
 On Nov 6, 2014 7:38 AM, "[hidden email] [flexcoders]" <
[hidden email]> wrote:

>
>
> when i click the download button, i get an error, concerning the path.
>  
>
Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list
In reply to this post by FlexCoders mailing list
I don't mean to be rude, but does it not occur to you that the actual text of the error message might be important in diagnosing your problem?
In your initial request for help, you didn't even bother to mention the problem was "concerning the path".
Stinasius, I'd like to help you, but if it requires dragging the needed information out of you, I'm afraid I don't have time, or the inclination.
Good luck.


     On Thursday, November 6, 2014 8:38 AM, "[hidden email] [flexcoders]" <[hidden email]> wrote:
   

 #yiv5947529375 #yiv5947529375 -- #yiv5947529375 .yiv5947529375ygrp-photo-title{clear:both;font-size:smaller;height:15px;overflow:hidden;text-align:center;width:75px;}#yiv5947529375 div.yiv5947529375ygrp-photo{background-position:center;background-repeat:no-repeat;background-color:white;border:1px solid black;height:62px;width:62px;}#yiv5947529375 div.yiv5947529375photo-title a, #yiv5947529375 div.yiv5947529375photo-title a:active, #yiv5947529375 div.yiv5947529375photo-title a:hover, #yiv5947529375 div.yiv5947529375photo-title a:visited {text-decoration:none;}#yiv5947529375 div.yiv5947529375attach-table div.yiv5947529375attach-row {clear:both;}#yiv5947529375 div.yiv5947529375attach-table div.yiv5947529375attach-row div {float:left;}#yiv5947529375 p {clear:both;padding:15px 0 3px 0;overflow:hidden;}#yiv5947529375 div.yiv5947529375ygrp-file {width:30px;}#yiv5947529375 div.yiv5947529375attach-table div.yiv5947529375attach-row div div a {text-decoration:none;}#yiv5947529375 div.yiv5947529375attach-table div.yiv5947529375attach-row div div span {font-weight:normal;}#yiv5947529375 div.yiv5947529375ygrp-file-title {font-weight:bold;}#yiv5947529375 #yiv5947529375 #yiv5947529375 #yiv5947529375 --#yiv5947529375ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv5947529375 #yiv5947529375ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv5947529375 #yiv5947529375ygrp-mkp #yiv5947529375hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv5947529375 #yiv5947529375ygrp-mkp #yiv5947529375ads {margin-bottom:10px;}#yiv5947529375 #yiv5947529375ygrp-mkp .yiv5947529375ad {padding:0 0;}#yiv5947529375 #yiv5947529375ygrp-mkp .yiv5947529375ad p {margin:0;}#yiv5947529375 #yiv5947529375ygrp-mkp .yiv5947529375ad a {color:#0000ff;text-decoration:none;}#yiv5947529375

when i click the download button, i get an error, concerning the path. 



   
Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list
Sorry guys, am really sorry. this is the error it shows " HTTP Status 404 - /campuscholar/bin-debug/documents/%7Bdocs.selectedItem.documentName%7D"
Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list
this line is at least one of your problems :

var url:String="documents/{docs.selectedItem.documentName}";

try something like :

var url:String="documents/" + docs.selectedItem.documentName;

That should get you closer at least.

From: [hidden email] [[hidden email]]
Sent: 06 November 2014 14:02
To: [hidden email]
Subject: [flexcoders] Re: downlaoding a file in flex.



Sorry guys, am really sorry. this is the error it shows "

HTTP Status 404 - /campuscholar/bin-debug/documents/%7Bdocs.selectedItem.documentName%7D
"


Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list

Doing this:var url:String="documents/" + encodeURIComponent(docs.selectedItem.documentName);
will handle cases where the document name contains special characters that would break the URL.

     On Thursday, November 6, 2014 9:14 AM, "Jim Hayes [hidden email] [flexcoders]" <[hidden email]> wrote:
   

 #yiv1014466686 #yiv1014466686 -- #yiv1014466686 .yiv1014466686ygrp-photo-title{clear:both;font-size:smaller;height:15px;overflow:hidden;text-align:center;width:75px;}#yiv1014466686 div.yiv1014466686ygrp-photo{background-position:center;background-repeat:no-repeat;background-color:white;border:1px solid black;height:62px;width:62px;}#yiv1014466686 div.yiv1014466686photo-title a, #yiv1014466686 div.yiv1014466686photo-title a:active, #yiv1014466686 div.yiv1014466686photo-title a:hover, #yiv1014466686 div.yiv1014466686photo-title a:visited {text-decoration:none;}#yiv1014466686 div.yiv1014466686attach-table div.yiv1014466686attach-row {clear:both;}#yiv1014466686 div.yiv1014466686attach-table div.yiv1014466686attach-row div {float:left;}#yiv1014466686 p {clear:both;padding:15px 0 3px 0;overflow:hidden;}#yiv1014466686 div.yiv1014466686ygrp-file {width:30px;}#yiv1014466686 div.yiv1014466686attach-table div.yiv1014466686attach-row div div a {text-decoration:none;}#yiv1014466686 div.yiv1014466686attach-table div.yiv1014466686attach-row div div span {font-weight:normal;}#yiv1014466686 div.yiv1014466686ygrp-file-title {font-weight:bold;}#yiv1014466686 #yiv1014466686 this line is at least one of your problems :
var url:String="documents/{docs.selectedItem.documentName}";
try something like :
var url:String="documents/" + docs.selectedItem.documentName;
That should get you closer at least.
From: [hidden email] [[hidden email]]Sent: 06 November 2014 14:02
To: [hidden email]
Subject: [flexcoders] Re: downlaoding a file in flex.

 Sorry guys, am really sorry. this is the error it shows "
HTTP Status 404 - /campuscholar/bin-debug/documents/%7Bdocs.selectedItem.documentName%7D
"#yiv1014466686 #yiv1014466686 --#yiv1014466686ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv1014466686 #yiv1014466686ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv1014466686 #yiv1014466686ygrp-mkp #yiv1014466686hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv1014466686 #yiv1014466686ygrp-mkp #yiv1014466686ads {margin-bottom:10px;}#yiv1014466686 #yiv1014466686ygrp-mkp .yiv1014466686ad {padding:0 0;}#yiv1014466686 #yiv1014466686ygrp-mkp .yiv1014466686ad p {margin:0;}#yiv1014466686 #yiv1014466686ygrp-mkp .yiv1014466686ad a {color:#0000ff;text-decoration:none;}#yiv1014466686 #yiv1014466686ygrp-sponsor #yiv1014466686ygrp-lc {font-family:Arial;}#yiv1014466686 #yiv1014466686ygrp-sponsor #yiv1014466686ygrp-lc #yiv1014466686hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv1014466686 #yiv1014466686ygrp-sponsor #yiv1014466686ygrp-lc .yiv1014466686ad {margin-bottom:10px;padding:0 0;}#yiv1014466686 #yiv1014466686actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv1014466686 #yiv1014466686activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv1014466686 #yiv1014466686activity span {font-weight:700;}#yiv1014466686 #yiv1014466686activity span:first-child {text-transform:uppercase;}#yiv1014466686 #yiv1014466686activity span a {color:#5085b6;text-decoration:none;}#yiv1014466686 #yiv1014466686activity span span {color:#ff7900;}#yiv1014466686 #yiv1014466686activity span .yiv1014466686underline {text-decoration:underline;}#yiv1014466686 .yiv1014466686attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv1014466686 .yiv1014466686attach div a {text-decoration:none;}#yiv1014466686 .yiv1014466686attach img {border:none;padding-right:5px;}#yiv1014466686 .yiv1014466686attach label {display:block;margin-bottom:5px;}#yiv1014466686 .yiv1014466686attach label a {text-decoration:none;}#yiv1014466686 blockquote {margin:0 0 0 4px;}#yiv1014466686 .yiv1014466686bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv1014466686 .yiv1014466686bold a {text-decoration:none;}#yiv1014466686 dd.yiv1014466686last p a {font-family:Verdana;font-weight:700;}#yiv1014466686 dd.yiv1014466686last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv1014466686 dd.yiv1014466686last p span.yiv1014466686yshortcuts {margin-right:0;}#yiv1014466686 div.yiv1014466686attach-table div div a {text-decoration:none;}#yiv1014466686 div.yiv1014466686attach-table {width:400px;}#yiv1014466686 div.yiv1014466686file-title a, #yiv1014466686 div.yiv1014466686file-title a:active, #yiv1014466686 div.yiv1014466686file-title a:hover, #yiv1014466686 div.yiv1014466686file-title a:visited {text-decoration:none;}#yiv1014466686 div.yiv1014466686photo-title a, #yiv1014466686 div.yiv1014466686photo-title a:active, #yiv1014466686 div.yiv1014466686photo-title a:hover, #yiv1014466686 div.yiv1014466686photo-title a:visited {text-decoration:none;}#yiv1014466686 div#yiv1014466686ygrp-mlmsg #yiv1014466686ygrp-msg p a span.yiv1014466686yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv1014466686 .yiv1014466686green {color:#628c2a;}#yiv1014466686 .yiv1014466686MsoNormal {margin:0 0 0 0;}#yiv1014466686 o {font-size:0;}#yiv1014466686 #yiv1014466686photos div {float:left;width:72px;}#yiv1014466686 #yiv1014466686photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv1014466686 #yiv1014466686photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv1014466686 #yiv1014466686reco-category {font-size:77%;}#yiv1014466686 #yiv1014466686reco-desc {font-size:77%;}#yiv1014466686 .yiv1014466686replbq {margin:4px;}#yiv1014466686 #yiv1014466686ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv1014466686 #yiv1014466686ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv1014466686 #yiv1014466686ygrp-mlmsg select, #yiv1014466686 input, #yiv1014466686 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv1014466686 #yiv1014466686ygrp-mlmsg * {line-height:1.22em;}#yiv1014466686 #yiv1014466686ygrp-mlmsg #yiv1014466686logo {padding-bottom:10px;}#yiv1014466686 #yiv1014466686ygrp-msg p a {font-family:Verdana;}#yiv1014466686 #yiv1014466686ygrp-msg p#yiv1014466686attach-count span {color:#1E66AE;font-weight:700;}#yiv1014466686 #yiv1014466686ygrp-reco #yiv1014466686reco-head {color:#ff7900;font-weight:700;}#yiv1014466686 #yiv1014466686ygrp-reco {margin-bottom:20px;padding:0px;}#yiv1014466686 #yiv1014466686ygrp-sponsor #yiv1014466686ov li a {font-size:130%;text-decoration:none;}#yiv1014466686 #yiv1014466686ygrp-sponsor #yiv1014466686ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv1014466686 #yiv1014466686ygrp-sponsor #yiv1014466686ov ul {margin:0;padding:0 0 0 8px;}#yiv1014466686 #yiv1014466686ygrp-text {font-family:Georgia;}#yiv1014466686 #yiv1014466686ygrp-text p {margin:0 0 1em 0;}#yiv1014466686 #yiv1014466686ygrp-text tt {font-size:120%;}#yiv1014466686 #yiv1014466686ygrp-vital ul li:last-child {border-right:none!important;}#yiv1014466686



   
Reply | Threaded
Open this post in threaded view
|

Re: downlaoding a file in flex.

FlexCoders mailing list
Thanks Guys. it worked like charm. Am very grateful for the help coming from this forum.