Solved

Looking for a solution to sync or otherwise an image folder that is uploaded to by clients in a Staging server and mirrored or copied to the Production website.

Posted on 2014-11-11
4
146 Views
Last Modified: 2014-12-17
Hello Experts,

I have a client that uploads blog images via the DMZ in a STAGING server ( using an ASP Upload DMX plugin ) however I would like that folder mirrored to the PRODUCTION website.

In order for me let the, use the form to upload to the STAGING server , I had to give that Internet Account in Security to modify so that it can upload the images.
Of course I cannot give the Internet account on the PRODUCTION website anything more than read.
Thus my dilemma.
I am not a wizard so any viable solution would be greatly appreciated!

Thank you in advance,

Using ASP Classic, VBScript, Windows 2008 Server , both servers are in the DMZ with the same domain.
0
Comment
Question by:colonelblue
4 Comments
 
LVL 2

Expert Comment

by:Glen Richmond
Comment Utility
can you give a specific application special permission and write your own sync app (ASP.Net/C#/VB.Net?) to run in the background (CGI?) being called everytime a file is copied to the STAGING area to copy to the PRODUCTION area?
0
 

Author Comment

by:colonelblue
Comment Utility
:( As I'm mentioned , I'm not a wizard,
0
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
Of course I cannot give the Internet account on the PRODUCTION website anything more than read.

makes sense. what about creating a different internet account that has read/write access ONLY on this particular site? or are you uncomfortable giving ANY account that kind of access?

if that's the case, you may better off writing a vbs script that runs under Scheduled Tasks, and does that file transfer directly that way
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
Why not just run it as a vbscript (save the file as a .vbs) and have your scheduled task run on the production server.

Taking the save example from http://www.webresizer.com/app/demos/code/asp.html
imagename = request("fileName")
url = request("url")
 
'Creating variables
 
imageUrl = url 
strImageName = imagename
 
'Function and subroutine calls
 
saveImage getImage(imageUrl), strImageName
 
'Here is code library:
 
Function getImage(strImageUrl)

  ' Set objHttp = CreateObject("Microsoft.XMLHTTP")
  ' Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")
  Set objHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
  ' Set Http = CreateObject("WinHttp.WinHttpRequest")
  objHttp.Open "GET", strImageUrl, False
  objHttp.Send
            
  getImage = objHttp.ResponseBody

End Function
 

Sub saveImage(ByteArray, strImageName)

  Const adTypeBinary = 1
  Const adSaveCreateOverWrite = 2
  Const adSaveCreateNotExist = 1
            
  Set objBinaryStream = CreateObject("ADODB.Stream")
  objBinaryStream.Type = adTypeBinary
            
  objBinaryStream.Open
  objBinaryStream.Write ByteArray
  objBinaryStream.SaveToFile server.mappath("images\" & strImageName) , 
      adSaveCreateOverWrite
  response.Write("Image has been downloaded and saved!")

end sub

Open in new window


On the production server, you just need to read which files are available, then  loop through those files, read the url where they are from and save.    Running this as a vbs file means you don't have to give permissions to the internet user account

For the first part, you need to read what is available.  Your upload script on the staging server can generate a file that lists the urls of images.  If you want to add a little security to that page.
if request.querystring("passcode")="some_long_pass_code" then
    response.write "<img src='/images/someimage.jpg'>"
    response.write "<img src='/images/someimage.jpg'>"
end if

Open in new window

That will list the images on the staging server.  Then you can loop through the images and save them using the first bit of code with some modification of course.

Check out aspupload http://www.aspupload.com/manual_security.html there is a way where you can set a password on a folder and aspupload can submit that info.


Why make it difficult for yourself.  Why not make one folder on the production server able to accept an image from your image upload simultaneously.   You can set an obscure folder with the write permissions, then once there, use fso to move it to the images folder.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now