Solved

Uploading file not in right format

Posted on 2006-11-13
6
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Don't Miss ATEN at InfoComm 2017!

Visit booth #2167 to see the  new ATEN VM3200 32 x 32 Modular Matrix Switch. Other highlights include the VE8950 4K HDMI Over IP Extender, VS1912 12-Port DP Video Wall Media Player  and VK2100 ATEN Control System. Register now with Free Pass Code ATEN288!

 
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

739 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