Skip to main content
Participating Frequently
September 17, 2007
Question

copying files into site

  • September 17, 2007
  • 3 replies
  • 738 views
How can I create an extension that when added automatically adds a required file/folder to the current dreamweaver website? I've seen other extensions add javascript and .gif files and folders but I cannot find any tutorials on how to do this.

Example is: I have an extension that places a link to a local file. I need to add that file into the users dreamweaver site so they can ftp it along with the webpage.

Thanks in advance
This topic has been closed for replies.

3 replies

Participating Frequently
October 8, 2007
I'm trying to use these DW functions to add a file to a site after someone finishes using my extension. The createFolder works but I cant copy the file which will be in the file:///C|/Config/Objects/GJHDigital/ folder that Dreamweaver creates when installed.

var fileURL = "file:///C|/Config/Objects/GJHDigital/test123.gif";
var SiteFolder = site.getLocalPathToFiles() + "Test";
DWfile.createFolder(SiteFolder);
DWfile.copy(fileURL, SiteFolder);

It does not return an error but if I put the function in an alert, I get a "false" on the DWFile.copy method.

thanks in advance.
Participating Frequently
September 17, 2007
thanks for responding, but what my extension is doing is adding some html to the page along with some javascript mouse events, and I am referencing a seperate .js file that has the functions that will need to be added automatically to the site in the same folder as where the webpage is. I dont want the developer using my extension having to go and search for my .js file and then add it to their site. I want it to copy their once they finish using the extension.

Do you know how to do that?
thanks
Inspiring
September 17, 2007
"gjhdigital" <webforumsuser@macromedia.com> wrote in message
news:fcmiee$4mf$1@forums.macromedia.com...
> thanks for responding, but what my extension is doing is adding some html
> to
> the page along with some javascript mouse events, and I am referencing a
> seperate .js file that has the functions that will need to be added
> automatically to the site in the same folder as where the webpage is. I
> dont
> want the developer using my extension having to go and search for my .js
> file
> and then add it to their site. I want it to copy their once they finish
> using
> the extension.
>
> Do you know how to do that?
> thanks

Sure, Dreamweaver CS3 introduces the function dom.copyAssets,
http://livedocs.adobe.com/en_US/Dreamweaver/9.0_API/dwr_pagecontent_cn_088.html
you pass it an array of AssetInfo objects, which are defined in
Shared/Common/Scripts/AssetInfoClass.js
for earlier versions of dreamweaver you'd have to create your own function
using DWFile.copy
http://livedocs.adobe.com/en_US/Dreamweaver/9.0_API/dwr_fileio_fi_04.html

Joris



Joris_van_Lier
Participant
September 17, 2007
quote:

Originally posted by: gjhdigital
How can I create an extension that when added automatically adds a required file/folder to the current dreamweaver website? I've seen other extensions add javascript and .gif files and folders but I cannot find any tutorials on how to do this.

Example is: I have an extension that places a link to a local file. I need to add that file into the users dreamweaver site so they can ftp it along with the webpage.

Thanks in advance


That functionality is already built into dreamweaver

try linking to a file outside your site, it'll pop up a message like the one below


This file is outside of the root folder of site 'mysite',
and may not be accessible when you publish the site.

Your root folder is:
C:\sites\mysite\

Would you like to copy the file there now?
---------------------------
Yes No
---------------------------