Solved

Uploading file not in right format

Posted on 2006-11-13
6
171 Views
Last Modified: 2010-03-04
Hi, i'm using an apache web-based application to upload certain files. Anyway, the files must be in a certain format. The format should be <server>-<version#>.zip.

Let's say the service name is service. In the past I was able to put something like server.3.5.6.zip and it would work. (Or server.3_5_6.zip).

Well, we migrated to another physical linux server, same specs (Red Hat ES 3.0). Copied all the same files over. Now when i try an upload a file, it won't take any files with "dots" in them, I get a format error. For example server.3.5.6.zip will not work but server.3_5_6.zip.

I went to the location of the page and it calls a file called deployment.php and in there it says:
$regex_match       = "$service-[0-9a-zA-Z_-]+\.zip" ;
$format_msg        = "ERROR - File must be in the format:  $service-version#.zip!" ;

I'm getting the format error. Now in the regex_match variable it doesn't say anything about a "." character. My question is, why was it working before? And how would I get it to accept "." in the version name?

The only difference between the old configuration and new one is that hte old was a virtual host while the new is the main (only) host.
0
Comment
Question by:pieman8080
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:bimal_linux
ID: 17937021
what is the magic_quotes_gpc status in your php.ini?

Bimal
0
 

Author Comment

by:pieman8080
ID: 17942330
magic_quotes_gpc = On
0
 
LVL 16

Expert Comment

by:HackneyCab
ID: 17942627
I'm not sure I understand your question. But the regex you demonstrate looks wrong. The $ symbol means "end of pattern", not "start of pattern". Does this do what you are aiming for:

$regex_match = "^service-[0-9a-zA-Z_-]+\.zip$";

or am I misunderstanding your question?
0
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
LVL 16

Accepted Solution

by:
HackneyCab earned 500 total points
ID: 17942655
Ah, sorry, you're trying to use $service as a variable. Also, I note that your pattern does not permit periods in the text before the file extension. Try this instead of my above suggestion:

$regex_match = $service.'-[0-9a-zA-Z_.-]+\.zip";

That will convert $service to a string (outside of the quotes, to be safe) and it allows periods in the pattern defined by the character class.
0
 

Author Comment

by:pieman8080
ID: 17942788
It worked, thank you! Note i didn't use the ' character. I tried putting the "." in the string but after the _- and it didn't work. When I put it in the middle as you suggested it worked.
0
 
LVL 16

Expert Comment

by:HackneyCab
ID: 17947142
Sorry, I was using the single-quote ' symbol to start the pattern string, but I've foolishly ended the pattern string with a double-quote " symbol. My bad.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHPmailer and exchange online(Office365) 3 465
Redirect from old domain to new domain 19 75
htaccess file 3 87
More Than One Website On Same DMZ Server 3 85
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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