Dropbox dead links - but a alternative isn't working?

0 favourites
  • 12 posts
From the Asset Store
Template for an alternative to falling shapes, fully documented in comments and video
  • Hi guys!

    Up until last wednesday i was able to use my code without any issues whatsoever.

    Now the files i was requesting turn out empty in my project. I checked the Dropbox URL and it is dead (as Dropbox dropped that direct access functionality recently).

    However, even after uploading this file to an FTP server I'm still not being able to read the file. I read something about MIME types conflicting with AJAX being able to read files?

    In other words:

    This no longer works:

    This does not work:

    You can try and access that last one yourself... you'll see a list of usernames but AJAX can't seem to fetch them.

    No other changes were made to the code whatsoever.

    Someone please help! All of my projects revolve around files and are no longer working since dropbox changed their ways - even though I can access them via an alternative method.

    Thanks for the tips in advance!

  • I think the server the file is on needs to allow an Ajax request or I think the wording is cross domain requests. Typically I just put files in the files folder of the project and not worry about it. You should also be able to upload the file the same place you uploaded your html export to. Although I guess you're using some other kind of export.

    I think there is an "on error" condition in the Ajax object that could be used to probably get an error message. You could also see if there's any settings you can set for the server you uploaded to? My guess is unless it's your own server you won't have control over that. Or maybe just try uploading somewhere else?

  • R0J0hound you're being extremely helpful as usual and you saved me several times now - so I really appreciate your reply!

    I believe you may be right.. I also read this article on Making AJAX requests cross-domain which I'm not sure if it may be causing issues.

    Update: got this error which definitely confirms it:

    I have one question though when using your method: I tried adding the file to my .capx folder and called it like this:

    or like this:

    None of those methods worked at all... am I doing something wrong when loading a local file?

    I was in preview and using a local .capx file/folder.

  • If you added the files from inside c2 the second should work. There's also the "request project file" action.

    I said "from inside c2" because I'm not sure just adding the the files in your project folder from Windows explorer is enough. I think there's an xml file the c2 uses to list the files, but c2 takes care of that when adding the files from the editor. If you are using the editor to add the files then disregard.

  • If you added the files from inside c2 the second should work.

    I was a bit confused by your reply. I can't seem to be able to add a file to the project... I suppose this could possibly be done using XML but to be honest i have no idea how to do that or if there's an easier approach.

    Instead I opted for the FileChooser object and then I asked AJAX to fetch the FileChooser's picked file's URL.

    However, this forces me to pick a file every single time I want to use my app since it does not allow for a default file to be picked at the start of the layout.

    This does work well.. but it is not viable for me to have to have to pick the same file every time just to get a proper URL to the file (a URL that works -> since I can't get my previous examples to work!).

    I noticed that the FileChooser's URL value is something like "Blob:http://localhost:50000/3e94a87df-6532-4413-n187-996830dnb630f" and it keeps changing every time I load the file manually.

    This is what I've got right now:

    ->Can there be a static URL to this local file?

    ->And how would you load it from inside Construct?

    Thanks!

  • I probably rambled too much. Maybe this is helpful?

    https://www.scirra.com/manual/141/files

  • I probably rambled too much. Maybe this is helpful?

    https://www.scirra.com/manual/141/files

    Oh thank you, I was right-clicking the wrong folder!

    However, this does not seem to help in my particular case as my intention is to read a .txt file every x seconds because that file keeps changing over time by using another piece of software. When I import it to Construct it becomes a static file inside the .capx that can't be edited by external applications...

    Any other ideas on how to access an external local file? <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    ~

    Thank you for your help!

  • There in lays the problem with any game that relies on outside files to run.

    The cloud is notorious for moving files to make space which changes the file pointers.

    People getting C3 that relies heavily on cloud storage are going to find that out the hard way I think.

  • If you use the nwjs export/preview you can use the readfile expression of the nwjs object to read a local file.

    For a normal HTML preview the browser should prevent access to local files. If you export as html you should be able to access files in that same folder if you just use "nomes.txt".

  • If you use the nwjs export/preview you can use the readfile expression of the nwjs object to read a local file.

    I believe you are right... the nwjs readfile expression really does work very well and just enough for my requirements (I can even link my local dropbox file path or to a file in the app's folder). Performance is great and the code is simpler than using AJAX functions. Only downsize is not being able to experiment with it in Preview mode - having to export every time - but for that i can instead use the previous Filechooser method I referred.

    For future reference to other people: the nwjs readfile retrieves the contents of the file by inputting its path.

    I'm saving these contents as a string. NWjs.AppFolder refers to the exported App's path, but you may instead type the full path in " " including the filename:

    For further info please refer to this document: Exporting desktop apps with NW.js.

    R0j0hound you've been awesome for helping me out again! Thank you so much!

  • To get it to work in preview mode with nwjs here is a strategy I've used.

    global text appfolder="c:\myfolder"

    Start of layout

    [negated] is preview

    --- set appfolder to nwjs.appfolder

    Basically, if you're in preview just use a direct folder path, otherwise use the nwjs.appfolder expression.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That may be a good tip for certain projects, but I really can't get nwjs to read the file in preview mode.

    So in preview, even if the path is correct, it just ignores the readfile command except when exported.

    It works well in export mode though.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)