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
154 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
ID: 40436835
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
ID: 40438474
:( As I'm mentioned , I'm not a wizard,
0
 
LVL 32

Expert Comment

by:Big Monty
ID: 40440141
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
ID: 40441798
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 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

22 Experts available now in Live!

Get 1:1 Help Now